/* ============================================================
   SmartBus — Responsive Styles
   Mobile-first adjustments
   ============================================================ */

/* ===== Desktop (default) ===== */
@media (max-width: 1180px) {
  :root {
    --sidebar-width: 240px;
  }
  .container { padding-inline: 1rem; }
}

/* ===== Tablet ===== */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-card .kpi-value { font-size: 1.5rem; }
  .panel-row { grid-template-columns: 1fr; }
  .hero { padding: 1.5rem; }
  .hero h2 { font-size: 1.25rem; }
  .map-container { height: 380px; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 2fr 1fr; }
  .kpi-card { padding: 1rem 0.7rem; }
  .kpi-card .kpi-value { font-size: 1.4rem; }

  .sidebar {
    width: 100%;
    max-width: 280px;
  }
  .main-content { margin-left: 0; }
  .main-content.sidebar-collapsed,
  .main-content.sidebar-hidden { margin-left: 0; }

  .topbar { padding: 0 0.8rem; }
  .topbar .app-title,
  .topbar .user-menu .user-name,
  .topbar .top-right > span:not(.demo-badge-wrapper) { display: none; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 0.7rem; }

  .cards { grid-template-columns: 1fr; }

  .map-legend {
    position: relative;
    top: auto;
    right: auto;
    margin-top: 0.7rem;
    justify-content: center;
  }

  .live-sim-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .live-sim-bar .left,
  .live-sim-bar .right { flex: 1; }

  .panel-row { grid-template-columns: 1fr; }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .table-actions .search-box { max-width: 100%; }

  /* Mobile bottom sheet for bus details */
  .bus-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg-elevated);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-xl);
    max-height: 60vh;
    transform: translateY(100%);
    transition: transform var(--transition-spring);
    z-index: 70;
    overflow-y: auto;
  }
  .bus-sheet.open { transform: translateY(0); }
  .bus-sheet .sheet-drag {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 0.6rem auto;
  }

  .demo-control-btn { bottom: 80px; }
}

/* ===== Small phone ===== */
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .topbar .top-right { display: none; }
}

/* ===== Touch targets ===== */
@media (hover: none) {
  .btn, .nav-item, .sim-btn, .tab, .list-item {
    min-height: 44px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
}
