/* Devices Dashboard Styles */
.page-title {
  color: #00b4d8;
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
}

/* Enhanced Search Box */
.search-box {
  position: relative;
}

.search-box input {
  background-color: #112240;
  border-color: #1d3557;
  color: #e6f1ff;
  border-radius: 8px;
  padding-left: 36px;
  transition: all 0.3s ease;
}

.search-box input:focus {
  background-color: #15294d;
  border-color: #00b4d8;
  box-shadow: 0 0 0 0.2rem rgba(0, 180, 216, 0.25);
}

.search-icon {
  position: absolute;
  top: 10px;
  left: 12px;
  color: #8892b0;
}

.search-box input:focus + .search-icon {
  color: #00b4d8;
}

/* Status Summary Cards */
.status-card {
  display: flex;
  align-items: center;
  background-color: #112240;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
  height: 100%;
  min-height: 95px;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.status-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.status-card::after {
  content: "";
  position: absolute;
  height: 100%;
  width: 5px;
  left: 0;
  top: 0;
}

.status-card.online::after {
  background-color: #06d6a0;
}

.status-card.offline::after {
  background-color: #ef476f;
}

.status-card.warning::after {
  background-color: #ffd60a;
}

.status-card.maintenance::after {
  background-color: #00b4d8;
}

.status-icon {
  font-size: 2.2rem;
  margin-right: 15px;
  width: 50px;
  text-align: center;
}

.status-card.online .status-icon {
  color: #06d6a0;
}

.status-card.offline .status-icon {
  color: #ef476f;
}

.status-card.warning .status-icon {
  color: #ffd60a;
}

.status-card.maintenance .status-icon {
  color: #00b4d8;
}

.status-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  color: #e6f1ff;
}

.status-info p {
  font-size: 0.9rem;
  color: #8892b0;
  margin: 0;
}

/* Filter Controls */
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background-color: #112240;
  border-radius: 10px;
  padding: 15px;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  font-size: 0.85rem;
  color: #8892b0;
  white-space: nowrap;
  margin-bottom: 0;
}

.filter-group .form-select {
  background-color: #0c1c33;
  border-color: #1d3557;
  color: #e6f1ff;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
}

#resetFilters {
  white-space: nowrap;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #0c1c33, #112240);
  border-radius: 10px;
  padding: 12px 15px;
  margin: 25px 0 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.section-header:hover {
  background: linear-gradient(90deg, #0d2142, #15294d);
}

.section-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

#engine-sensors::after {
  background: linear-gradient(90deg, #ef476f, #ff6b6b);
}

#fuel-sensors::after {
  background: linear-gradient(90deg, #ffa62b, #ffd60a);
}

#navigation-sensors::after {
  background: linear-gradient(90deg, #00b4d8, #90e0ef);
}

#environmental-sensors::after {
  background: linear-gradient(90deg, #06d6a0, #8eedc7);
}

.section-icon {
  font-size: 1.5rem;
  margin-right: 15px;
  width: 30px;
  text-align: center;
}

#engine-sensors .section-icon {
  color: #ff6b6b;
}

#fuel-sensors .section-icon {
  color: #ffd60a;
}

#navigation-sensors .section-icon {
  color: #00b4d8;
}

#environmental-sensors .section-icon {
  color: #06d6a0;
}

.section-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e6f1ff;
  margin: 0;
  flex-grow: 1;
}

.section-count {
  background-color: #0a192f;
  color: #8892b0;
  padding: 3px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  margin-right: 15px;
}

.section-toggle {
  font-size: 1rem;
  color: #8892b0;
  transition: transform 0.3s ease;
}

.section-header.collapsed .section-toggle {
  transform: rotate(-90deg);
}

/* Device Cards */
.device-cards {
  margin-bottom: 20px;
}

.device-card {
  background-color: #112240;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  position: relative;
}

.device-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

.device-card.online::before {
  background: linear-gradient(90deg, #06d6a0, #8eedc7);
}

.device-card.offline::before {
  background: linear-gradient(90deg, #ef476f, #ff6b6b);
}

.device-card.warning::before {
  background: linear-gradient(90deg, #ffd60a, #ffee99);
}

.device-card.maintenance::before {
  background: linear-gradient(90deg, #00b4d8, #90e0ef);
}

.device-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25);
}

.device-header {
  padding: 15px;
  background-color: rgba(12, 28, 51, 0.7);
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid #1d3557;
  position: relative;
}

.device-icon {
  font-size: 1.3rem;
  margin-right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: #0a192f;
  color: #e6f1ff;
  flex-shrink: 0;
}

.device-card.online .device-icon {
  color: #06d6a0;
  background-color: rgba(6, 214, 160, 0.15);
}

.device-card.offline .device-icon {
  color: #ef476f;
  background-color: rgba(239, 71, 111, 0.15);
}

.device-card.warning .device-icon {
  color: #ffd60a;
  background-color: rgba(255, 214, 10, 0.15);
}

.device-card.maintenance .device-icon {
  color: #00b4d8;
  background-color: rgba(0, 180, 216, 0.15);
}

.device-title {
  flex-grow: 1;
  margin-right: 10px;
}

.device-title h4 {
  font-size: 1rem;
  margin: 0 0 3px 0;
  font-weight: 600;
  color: #e6f1ff;
  line-height: 1.3;
}

.device-location {
  font-size: 0.8rem;
  color: #8892b0;
  display: block;
}

.device-status {
  margin-left: auto;
  flex-shrink: 0;
}

.status-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-badge.online {
  background-color: rgba(6, 214, 160, 0.15);
  color: #06d6a0;
}

.status-badge.offline {
  background-color: rgba(239, 71, 111, 0.15);
  color: #ef476f;
}

.status-badge.warning {
  background-color: rgba(255, 214, 10, 0.15);
  color: #ffd60a;
}

.status-badge.maintenance {
  background-color: rgba(0, 180, 216, 0.15);
  color: #00b4d8;
}

/* Device Body */
.device-body {
  padding: 15px;
}

.device-reading {
  text-align: center;
  margin-bottom: 12px;
}

.reading-value {
  font-size: 2rem;
  font-weight: 700;
  color: #e6f1ff;
}

.reading-unit {
  font-size: 1rem;
  color: #8892b0;
  margin-left: 3px;
}

.device-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.meta-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #8892b0;
}

.meta-item i {
  width: 20px;
  margin-right: 8px;
  text-align: center;
  color: #00b4d8;
}

.meta-item strong {
  color: #e6f1ff;
  margin-left: 3px;
}

/* Specialized device content */
.device-specific {
  background-color: rgba(12, 28, 51, 0.5);
  border-radius: 8px;
  padding: 10px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.accuracy-info {
  display: flex;
  justify-content: space-around;
}

.accuracy-info span {
  color: #8892b0;
}

.accuracy-info strong {
  color: #e6f1ff;
  margin-left: 3px;
}

.device-warning,
.device-error {
  background-color: rgba(239, 71, 111, 0.15);
  color: #ef476f;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.device-warning i,
.device-error i {
  margin-right: 8px;
}

.sensor-progress {
  margin-top: 15px;
}

.progress {
  height: 8px;
  background-color: #0a192f;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, #06d6a0, #8eedc7);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #8892b0;
  margin-top: 5px;
}

/* Multi-reading for devices with multiple values */
.device-reading.multi-reading {
  display: flex;
  justify-content: space-around;
}

.device-reading.multi-reading div {
  text-align: center;
}

.reading-label {
  display: block;
  font-size: 0.85rem;
  color: #8892b0;
  margin-bottom: 5px;
}

.device-reading.small-text .reading-value {
  font-size: 1.1rem;
  word-break: break-all;
}

/* Device Footer */
.device-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  background-color: rgba(12, 28, 51, 0.5);
  border-top: 1px solid #1d3557;
}

.device-footer .btn {
  font-size: 0.8rem;
  padding: 4px 10px;
}

/* Device Details Modal */
.device-detail-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.device-title-area {
  flex: 1;
  min-width: 250px;
}

.device-title-area h4 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: #e6f1ff;
}

.device-meta-area {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 10px;
}

.detail-tabs .nav-tabs {
  border-color: #1d3557;
}

.detail-tabs .nav-link {
  color: #8892b0;
  background-color: transparent;
  border: none;
  padding: 8px 15px;
}

.detail-tabs .nav-link.active {
  color: #00b4d8;
  background-color: #0a192f;
  border-color: #1d3557 #1d3557 #0a192f;
}

.detail-tabs .tab-content {
  background-color: #0a192f;
  border-color: #1d3557;
}

.history-filters .btn-group .btn {
  font-size: 0.85rem;
  padding: 4px 12px;
}

.history-filters .btn-outline-secondary {
  color: #8892b0;
  border-color: #1d3557;
}

.history-filters .btn-outline-secondary:hover {
  background-color: #1d3557;
  color: #e6f1ff;
}

.specs-table th {
  width: 200px;
  color: #8892b0;
  font-weight: 500;
}

.specs-table td {
  color: #e6f1ff;
}

.maintenance-history .card-title,
.maintenance-schedule .card-title {
  color: #00b4d8;
  font-size: 1.1rem;
}

/* Add Device Modal */
.modal-content {
  background-color: #0c1c33;
  border: 1px solid #1d3557;
}

.modal-header {
  border-bottom-color: #1d3557;
}

.modal-footer {
  border-top-color: #1d3557;
}

.modal-title {
  color: #e6f1ff;
}

.form-label {
  color: #e6f1ff;
  font-size: 0.9rem;
}

.form-control,
.form-select {
  background-color: #0a192f;
  border-color: #1d3557;
  color: #e6f1ff;
}

.form-control:focus,
.form-select:focus {
  background-color: #112240;
  border-color: #00b4d8;
  box-shadow: 0 0 0 0.2rem rgba(0, 180, 216, 0.25);
  color: #e6f1ff;
}

.form-control::placeholder {
  color: #8892b0;
}

/* Add animation to status cards */
.status-card .status-icon i {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Loading animation for the refresh button */
.refreshing {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
  .filter-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group {
    width: 100%;
  }

  #resetFilters {
    align-self: flex-end;
  }

  .device-details-modal .modal-dialog {
    max-width: 95%;
  }
}

@media (max-width: 767.98px) {
  .page-title {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 15px;
  }

  .btn-add-device {
    width: 100%;
    margin-top: 15px;
  }

  .device-title-area,
  .device-meta-area {
    width: 100%;
  }

  .device-detail-header {
    flex-direction: column;
    gap: 15px;
  }

  .device-meta-area {
    justify-content: space-between;
  }

  .history-filters .btn-group {
    margin-bottom: 10px;
  }

  .device-footer {
    flex-wrap: wrap;
  }

  .device-footer .btn {
    margin-bottom: 5px;
  }
}

@media (max-width: 575.98px) {
  .filter-controls {
    padding: 10px;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .filter-group label {
    margin-bottom: 5px;
  }

  .filter-group .form-select {
    width: 100%;
  }

  .section-header {
    flex-wrap: wrap;
    padding: 10px;
  }

  .section-count {
    margin-left: auto;
    margin-right: 10px;
  }

  .device-reading .reading-value {
    font-size: 1.7rem;
  }

  .device-reading.multi-reading {
    flex-direction: column;
    gap: 10px;
  }

  .device-footer {
    padding: 10px;
    gap: 5px;
  }

  .device-footer .btn {
    padding: 3px 8px;
    font-size: 0.75rem;
  }
}
