/* ============================================================
   RESPONSIVE.CSS — Mobile, tablet, desktop
   NavyTrack
   ============================================================ */

/* ── TABLET (≤ 1024px) ── */
@media (max-width: 1024px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .search-input { width: 200px; }
  .search-input:focus { width: 220px; }
  .detail-panel { width: 360px; }
}

/* ── MOBILE (≤ 768px) ── */
@media (max-width: 768px) {
  :root {
    --header-h: 52px;
  }

  /* HEADER */
  .header-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-sub { display: none; }
  .brand-name { font-size: 1rem; }
  .brand-icon { width: 28px; height: 28px; }

  /* STATUS — compact */
  .header-status {
    flex: 1;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
  }
  .status-label {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
  .status-time { display: none; }
  .status-dot { width: 6px; height: 6px; flex-shrink: 0; }

  /* HEADER ACTIONS */
  .header-actions { gap: 4px; }
  .btn-icon { width: 32px; height: 32px; }
  .btn-icon svg { width: 14px; height: 14px; }

  /* MAIN */
  .app-main {
    padding: 12px 12px 32px;
    gap: 10px;
  }

  /* STATS BAR */
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-value {
    font-size: 1.5rem;
  }
  .stat-label {
    font-size: 0.65rem;
  }

  /* FILTERS */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .filters-left {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filters-right {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filter-chips { flex-wrap: wrap; gap: 6px; }
  .chip { padding: 6px 14px; font-size: 0.82rem; }
  .filter-select {
    width: 100%;
    padding: 9px 28px 9px 10px;
    font-size: 0.85rem;
  }
  .search-wrap { width: 100%; }
  .search-input {
    width: 100%;
    font-size: 0.85rem;
    padding: 9px 12px 9px 32px;
  }
  .search-input:focus { width: 100%; }
  .refresh-control {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .refresh-control .filter-select { flex: 1; }

  /* TABLE */
  .table-scroll {
    max-height: calc(100vh - 380px);
    min-height: 200px;
  }
  .data-table { font-size: 0.78rem; }
  .data-table th { padding: 8px 10px; font-size: 0.65rem; }
  .data-table td { padding: 10px 10px; }

  /* Hide less critical columns on mobile */
  .data-table th:nth-child(5),
  .data-table td:nth-child(5),
  .data-table th:nth-child(6),
  .data-table td:nth-child(6),
  .data-table th:nth-child(10),
  .data-table td:nth-child(10) {
    display: none;
  }

  /* DETAIL PANEL */
  .detail-panel {
    width: 100%;
    top: auto;
    height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }
  .detail-panel.open { transform: translateY(0); }

  /* MODAL */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }
  .modal-body {
    max-height: 65vh;
    overflow-y: auto;
  }
  .modal-header { padding: 20px 20px 16px; }
  .modal-footer { padding: 12px 20px 28px; }

  /* API MODAL */
  .api-row { grid-template-columns: 1fr; }
  .api-source { padding: 12px; }
  .regions-grid { grid-template-columns: 1fr; }

  /* TOAST */
  .toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }
  .toast { max-width: 100%; font-size: 0.8rem; }

  /* HEADING DIAL */
  .heading-dial { width: 24px; height: 24px; }
  .heading-dial svg { width: 24px; height: 24px; }

  /* DETAIL MAP */
  .detail-map { height: 180px; }
  .detail-photo { max-height: 180px; }
}

/* ── SMALL MOBILE (≤ 390px) ── */
@media (max-width: 390px) {
  .stat-value { font-size: 1.3rem; }
  .brand-name { font-size: 0.95rem; }
  .status-label { max-width: 90px; }

  /* Hide extra header buttons */
  .header-actions .btn-icon:nth-child(2) { display: none; }

  /* Table — show only essentials */
  .data-table th:nth-child(4),
  .data-table td:nth-child(4),
  .data-table th:nth-child(9),
  .data-table td:nth-child(9) {
    display: none;
  }
}

/* ── TABLET PORTRAIT (768px - 1024px) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .filters-bar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .filters-left { flex-wrap: wrap; }
  .search-input { width: 220px; }
  .detail-panel { width: 380px; }
  .stats-bar { grid-template-columns: repeat(4, 1fr); }
}

/* ── LARGE DESKTOP (≥ 1400px) ── */
@media (min-width: 1400px) {
  .app-main { padding: 28px 32px 48px; }
  .data-table { font-size: 0.85rem; }
  .stat-value { font-size: 2rem; }
}
