:root {
  --gw-bg-body: #f1eff0;
  --gw-bg-surface: #f1eff0;
  --gw-bg-card: #f1eff0;
  --gw-bg-card-header: #dedbde;
  --gw-border: #d2d0d1;
  --gw-border-highlight: #6686b9;
  --gw-nav-bg: #6686b9;
  --gw-nav-brand: #39c1f0;
  --gw-table-th-bg: #b3b1b2;
  --gw-table-tbody-bg: #d2d0d1;
  --gw-table-tbody-stripe: #dad8d9;
  --gw-table-hover: #c4c2c3;
  --gw-text-main: #1f2937;
  --gw-text-muted: #4b5563;
  --gw-text-dim: #6b7280;
  --gw-green-normal: #047857;
  --gw-green-bg: #d1fae5;
  --gw-amber-warn: #b45309;
  --gw-amber-bg: #fef3c7;
  --gw-orange-hot: #c2410c;
  --gw-red-alert: #dc2626;
  --gw-red-bg: #fee2e2;
  --gw-red-glow: rgba(220, 38, 38, 0.4);
  --gw-cyan-info: #0284c7; }

html, body {
  background-color: #f1eff0;
  color: #1f2937;
  font-family: "Outfit", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; }

body {
  background-color: #f1eff0; }

.text-dark {
  color: #1f2937 !important; }

.text-muted {
  color: #4b5563 !important; }

.bg-light {
  background-color: #ebe8ea !important; }

.btn-warning {
  background-color: #ffc107 !important;
  border-color: #ffc107 !important;
  color: #111827 !important; }
  .btn-warning:hover {
    background-color: #e0a800 !important;
    border-color: #d39e00 !important;
    color: #111827 !important; }

::-webkit-scrollbar {
  width: 8px;
  height: 8px; }

::-webkit-scrollbar-track {
  background: #e5e7eb; }

::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 4px; }

::-webkit-scrollbar-thumb:hover {
  background: #6b7280; }

.gw-navbar {
  background-color: #6686b9 !important;
  border-bottom: 3px solid #39c1f0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15); }
  .gw-navbar .navbar-brand {
    color: #39c1f0 !important;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
    .gw-navbar .navbar-brand:hover {
      color: #68d0f4 !important; }
  .gw-navbar .nav-link {
    color: #ffffff !important;
    font-weight: 500;
    transition: all 0.2s ease; }
    .gw-navbar .nav-link:hover, .gw-navbar .nav-link.active {
      color: #39c1f0 !important;
      text-shadow: 0 0 6px rgba(57, 193, 240, 0.4); }

.navbar-brand {
  color: #39c1f0 !important; }

.gw-footer {
  background-color: #6686b9 !important;
  border-top: 3px solid #39c1f0 !important;
  color: #ffffff; }

.gw-card {
  background: #f1eff0;
  border: 1px solid #d2d0d1;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden; }
  .gw-card:hover {
    border-color: #6686b9;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); }
  .gw-card .gw-card-header {
    background: #dedbde;
    border-bottom: 1px solid #c4c2c3;
    padding: 12px 18px;
    color: #1f2937;
    font-weight: 600; }
  .gw-card .gw-card-body {
    padding: 16px;
    background: #f1eff0; }
  .gw-card .gw-card-footer {
    background: #dedbde;
    border-top: 1px solid #d2d0d1;
    padding: 10px 16px;
    color: #4b5563;
    font-size: 0.875rem; }

.gw-nav-tabs {
  border-bottom: 2px solid #d2d0d1;
  gap: 4px;
  padding-bottom: 0; }
  .gw-nav-tabs .nav-item .nav-link {
    background: #dedbde;
    color: #4b5563;
    border: 1px solid #d2d0d1;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    padding: 9px 18px;
    transition: all 0.2s ease; }
    .gw-nav-tabs .nav-item .nav-link:hover {
      color: #2b4881;
      background: #d2d0d1; }
    .gw-nav-tabs .nav-item .nav-link.active {
      color: #2b4881 !important;
      background: #f1eff0;
      border-color: #d2d0d1 #d2d0d1 transparent #d2d0d1;
      border-top: 3px solid #6686b9;
      box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05); }

.gw-table-container {
  background: #d2d0d1;
  border: 1px solid #1f2937;
  border-radius: 8px;
  overflow: hidden; }

.gw-table {
  width: 100%;
  margin-bottom: 0;
  color: #1f2937;
  border-collapse: separate;
  border-spacing: 0; }
  .gw-table thead th {
    background: #b3b1b2;
    color: #1f2937;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid #030506; }
  .gw-table tbody tr {
    background: #f8f9fa;
    color: #1f2937;
    transition: background-color 0.15s ease; }
    .gw-table tbody tr:nth-child(even) {
      background: #dad8d9; }
    .gw-table tbody tr:hover {
      background: #c4c2c3 !important;
      cursor: pointer; }
    .gw-table tbody tr td, .gw-table tbody tr th {
      padding: 10px 14px;
      vertical-align: middle;
      border-bottom: 1px solid #dae0e5;
      font-size: 0.95rem; }
  .gw-table tr.gw-row-alarm {
    background: #fee2e2 !important;
    border-left: 4px solid #ef4444; }
    .gw-table tr.gw-row-alarm:hover {
      background: #fecaca !important; }

.table-secondary {
  --bs-table-bg: #d2d0d1;
  --bs-table-striped-bg: #dad8d9;
  --bs-table-hover-bg: #c4c2c3;
  color: #1f2937; }

thead.table-secondary {
  --bs-table-bg: #b3b1b2;
  color: #111827; }

.gw-stat-tile {
  background: #ebe8ea;
  border: 1px solid #d2d0d1;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease; }
  .gw-stat-tile .stat-label {
    color: #4b5563;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600; }
  .gw-stat-tile .stat-value {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700; }
  .gw-stat-tile:hover {
    border-color: #6686b9;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); }

.gw-temp-normal {
  color: #047857;
  font-weight: 700; }

.gw-temp-warm {
  color: #b45309;
  font-weight: 700; }

.gw-temp-hot {
  color: #c2410c;
  font-weight: 700; }

.gw-temp-alarm {
  color: #ffffff !important;
  background: #dc2626;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
  animation: gw-pulse 2s infinite ease-in-out; }

.gw-bat-good {
  color: #047857;
  font-weight: 700; }

.gw-bat-warn {
  color: #b45309;
  font-weight: 700; }

.gw-bat-crit {
  color: #dc2626;
  font-weight: 700;
  animation: gw-pulse 2s infinite ease-in-out; }

.gw-time-fresh {
  color: #047857; }

.gw-time-stale {
  color: #b45309; }

.gw-time-offline {
  color: #7c3aed;
  font-weight: 600; }

.gw-pulse-glow {
  animation: gw-pulse-glow 2s infinite ease-in-out;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  letter-spacing: 0.3px;
  font-weight: 700 !important;
}

@keyframes gw-pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    transform: scale(1);
  }
}

.gw-time-container {
  display: inline-flex;
  align-items: center;
  transition: background-color 0.3s ease;
}

.gw-badge-purple {
  background-color: #7c3aed !important;
  color: #ffffff !important; }

.gw-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px; }
  .gw-badge.badge-ok {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981; }
  .gw-badge.badge-alarm {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    animation: gw-pulse 1.8s infinite ease-in-out; }
  .gw-badge.badge-offline {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #8b5cf6; }
  .gw-badge.badge-cleared {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #38bdf8; }

@keyframes gw-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  70% {
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
.btn-gw-primary {
  background: #6686b9;
  border-color: #6686b9;
  color: #ffffff;
  font-weight: 600;
  transition: all 0.2s ease; }
  .btn-gw-primary:hover {
    background: #4a6ca2;
    border-color: #4a6ca2;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(102, 134, 185, 0.4); }

.btn-gw-outline {
  background: transparent;
  border: 1px solid #6686b9;
  color: #6686b9;
  font-weight: 500;
  transition: all 0.2s ease; }
  .btn-gw-outline:hover {
    background: #6686b9;
    border-color: #6686b9;
    color: #ffffff; }

.modal-content {
  background-color: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid #f8f9fa !important;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); }
  .modal-content .modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #1f2937; }
  .modal-content .modal-footer {
    border-top: 1px solid #f8f9fa; }
  .modal-content .form-control, .modal-content .form-select {
    background-color: #ffffff !important;
    border-color: #1f2937 !important;
    color: #1f2937 !important; }
    .modal-content .form-control:focus, .modal-content .form-select:focus {
      border-color: #6686b9 !important;
      box-shadow: 0 0 0 0.25rem rgba(102, 134, 185, 0.25) !important; }

.plotly-graph-container,
.plotly-graph-div,
.js-plotly-plot {
  width: 100% !important;
  max-width: 100% !important;
  display: block; }

.js-plotly-plot .plotly,
.js-plotly-plot .plotly .main-svg,
.js-plotly-plot .plotly .svg-container {
  width: 100% !important; }

.col-background-image {
  background-image: url("images/Granary_revised.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  min-height: 250px;
  position: relative;
  overflow: hidden;
  border: 1px solid #c4c2c3;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
  .col-background-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(241, 239, 240, 0.88);
    z-index: 1; }
  .col-background-image > * {
    position: relative;
    z-index: 2; }

/* =========================================
   Mobile Optimization & Responsive Styles
   ========================================= */

@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
    -webkit-text-size-adjust: 100%;
  }

  /* Optimize touch target sizes (min 40-44px) */
  .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-sm {
    min-height: 32px;
  }

  /* Compact padding for cards on mobile */
  .gw-card .gw-card-header {
    padding: 10px 12px;
  }

  .gw-card .gw-card-body {
    padding: 12px;
  }

  .gw-card .gw-card-footer {
    padding: 8px 12px;
  }

  /* Responsive Tab Bars */
  .gw-nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    gap: 2px;
  }

  .gw-nav-tabs .nav-item {
    flex-shrink: 0;
  }

  .gw-nav-tabs .nav-item .nav-link {
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* Plotly touch container optimization */
  .plotly-graph-container,
  .plotly-graph-div,
  .js-plotly-plot {
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
  }

  /* Form controls easy to tap on phones */
  .form-control, .form-select {
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    min-height: 42px;
  }

  .form-control-sm, .form-select-sm {
    min-height: 36px;
  }
}

/* Mobile Bottom Navigation Bar */
.gw-mobile-bottom-nav {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gw-mobile-bottom-nav .btn-link {
  color: #9ca3af;
  transition: color 0.15s ease;
}

.gw-mobile-bottom-nav .btn-link:hover,
.gw-mobile-bottom-nav .btn-link:active {
  color: #39c1f0;
}

