/* Pella Mobile Responsive — hamburger menu + layout overrides */

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--navy, #2d2035);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: background .15s;
  line-height: 1;
}
.hamburger-btn:hover { background: #3d2e48; }

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
  opacity: 0;
  transition: opacity .3s ease;
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* Close button inside sidebar (mobile only) */
.sidebar-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}
.sidebar-close:hover { color: #fff; }

/* ============ MOBILE: < 768px ============ */
@media (max-width: 767px) {
  /* Show hamburger */
  .hamburger-btn {
    display: flex;
  }

  /* Sidebar: off-screen overlay */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 160;
    transform: translateX(-100%);
    transition: transform .3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  /* Main content: no margin */
  .main {
    margin-left: 0 !important;
  }

  /* Topbar: add left padding for hamburger */
  .topbar {
    padding-left: 60px !important;
    padding-right: 12px !important;
    gap: 8px !important;
  }
  .topbar select, .topbar input {
    font-size: 12px;
    padding: 6px 8px;
  }
  .topbar .date-input {
    width: 140px;
  }

  /* Scorecards: 2 per row */
  .scorecards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .scorecard {
    padding: 12px;
  }
  .scorecard-value {
    font-size: 18px;
  }

  /* Charts: full width */
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .chart-card {
    margin-bottom: 16px;
  }
  .chart-body {
    padding: 12px;
  }

  /* Tables: horizontal scroll */
  .table-wrap, .chart-card:has(.data-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 600px;
  }

  /* Content padding */
  .content {
    padding: 16px !important;
  }

  /* Toggle / pill bars */
  .toggles-bar {
    padding: 10px 12px !important;
    gap: 8px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
  }
  .toggle-group {
    flex-shrink: 0;
  }
  .pill {
    font-size: 11px;
    padding: 4px 10px;
    white-space: nowrap;
  }

  /* Tabs bar */
  .tabs-bar {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tab {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Actions row */
  .actions-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .actions-row .left {
    font-size: 16px;
  }

  /* Filter pills row */
  .filter-row, .filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 6px;
  }

  /* KPI / stat grids that might use other classes */
  .kpi-grid, .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Cards general */
  .card {
    padding: 24px !important;
  }
}

/* ============ SMALL MOBILE: < 480px ============ */
@media (max-width: 479px) {
  .scorecards {
    grid-template-columns: 1fr !important;
  }
  .kpi-grid, .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .topbar select, .topbar input {
    width: 100%;
  }
  .topbar .date-input {
    width: 100%;
  }
}
