/* ─── ALL responsive overrides — edit this file for mobile/tablet layout changes ─── */

/* ═══════════════════════════════════════════════════════
   TABLET  max-width: 1060px
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1060px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 24px;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .dashboard,
  .cities {
    grid-template-columns: 1fr;
  }

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

  .search-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-button {
    grid-column: 1 / -1;
  }

  .insights {
    grid-template-columns: repeat(2, 1fr);
  }

  .city-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ═══════════════════════════════════════════════════════
   MOBILE  max-width: 680px
   ═══════════════════════════════════════════════════════ */

@media (max-width: 680px) {
  .shell {
    width: min(100% - 22px, 1280px);
  }

  /* ── Topbar ── */
  .topbar {
    min-height: 56px;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0;
    padding: 0 14px;
  }

  /* lang + font-scale stay visible on mobile but compact */
  .lang-control select {
    min-width: 54px;
    min-height: 32px;
    font-size: 0.75rem;
    padding: 0 2px 0 4px;
    border-radius: 6px;
  }

  .font-scale-control span {
    display: none;
  }

  .font-scale-control select {
    width: 40px;
    min-height: 32px;
    font-size: 0.75rem;
    padding: 0 2px 0 4px;
    border-radius: 6px;
  }

  .brand {
    font-size: 22px;
  }

  .nav-actions .ghost,
  .nav-actions .primary {
    display: none;
  }

  .nav-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
    width: auto;
    padding-bottom: 0;
    gap: 2px;
  }

  .mobile-only {
    display: flex;
  }

  /* ── Hero ── */
  .hero {
    padding: 16px 0 12px;
  }

  .seo-hero {
    padding: 48px 0 30px;
  }

  .seo-hero h1 {
    font-size: 40px;
  }

  .seo-hero p:not(.product-focus) {
    font-size: 16px;
  }

  .seo-content {
    grid-template-columns: 1fr;
    padding-bottom: 42px;
  }

  .seo-store-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: 36px;
    line-height: 1.05;
    letter-spacing: -0.03em;
  }

  .hero-copy p {
    display: none;
  }

  .product-focus {
    display: none;
  }

  /* ── Search panel — 2×2 grid on mobile ── */
  .search-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .search-button {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
  }

  .search-panel select,
  .search-panel input {
    min-height: 40px;
    font-size: 0.875rem;
    padding: 0 8px;
  }

  .search-panel label > span {
    font-size: 0.5625rem;
  }

  /* ── Alert composer ── */
  .composer-grid {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  /* ── Metrics strip — 4 columns with icons ── */
  .metric-card {
    grid-template-columns: repeat(4, 1fr);
  }

  .metric-card div {
    min-height: 64px;
    padding: 10px 6px;
    gap: 3px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    place-content: center;
    text-align: center;
  }

  .metric-card div:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .metric-card div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .metric-card div:last-child {
    border-right: 0;
  }

  .metric-card strong {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .metric-card span {
    font-size: 0.5rem;
    line-height: 1.3;
  }

  .metric-icon,
  .live-dot {
    display: block;
    margin-inline: auto;
  }

  /* ── Dashboard — map appears first (natural HTML order) ── */
  .map-card {
    display: flex;
    flex-direction: column;
    min-height: unset;
    order: 1;
  }

  .availability {
    order: 2;
    max-height: none;
  }

  /* ── Map card — summary becomes a header bar above the map ── */
  .map-summary {
    position: static;
    width: auto;
    box-shadow: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: auto;
    border-bottom: 1px solid var(--line);
  }

  .map-summary-info {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .map-summary-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
  }

  .map-summary strong {
    font-size: 1.625rem;
    letter-spacing: -0.03em;
  }

  .map-summary span {
    font-size: 0.9375rem;
    font-weight: 800;
  }

  .map-summary small {
    font-size: 0.75rem;
    color: var(--muted);
  }

  .map-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    background: var(--surface);
  }

  .map-open-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .map-frame {
    position: relative;
    flex: 1;
    min-height: 220px;
  }

  /* ── Table ── */
  .list-controls {
    display: none;
  }

  table {
    table-layout: fixed;
    width: 100%;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }

  th:nth-child(1), td:nth-child(1) { width: 22%; }
  th:nth-child(2), td:nth-child(2) { width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  th:nth-child(4), td:nth-child(4) { width: 18%; }
  th:nth-child(5), td:nth-child(5) { width: 21%; }
  th:nth-child(6), td:nth-child(6) { width: 9%; text-align: center; }

  th,
  td {
    padding: 9px 4px;
    font-size: 0.75rem;
  }

  /* ── Stock badge → colored dot on mobile ── */
  .badge {
    font-size: 0;
    width: 10px;
    height: 10px;
    min-height: unset;
    border-radius: 50%;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
  }

  .badge.stock { background: var(--success); }
  .badge.low   { background: var(--warning); }
  .badge.out   { background: #c03030; }

  /* ── Footer ── */
  .footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 0;
  }

  .footer nav {
    flex-wrap: wrap;
  }

  /* ── Analytics banner ── */
  .analytics-banner {
    left: 11px;
    right: 11px;
    bottom: 11px;
    width: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-banner div {
    width: 100%;
  }

  .analytics-banner .button {
    flex: 1;
  }

  /* ── Insights strip — alert card replaced by mobile upsell ── */
  .insights {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .alert-card,
  .health-card {
    display: none;
  }

  .chart-card,
  .alternatives-card {
    padding: 14px;
  }

  .chart-card h2,
  .alternatives-card h2 {
    font-size: 0.9375rem;
  }

  /* ── Mobile upsell card ── */
  .mobile-upsell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 14px;
    grid-column: 1 / -1;
    border: 1px solid color-mix(in srgb, #0ca99b 30%, var(--line));
    border-radius: var(--radius);
    background: color-mix(in srgb, #0ca99b 7%, var(--surface));
    box-shadow: var(--shadow);
  }

  .mobile-upsell-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, #0ca99b 18%, var(--surface));
    color: #0ca99b;
  }

  .mobile-upsell-body {
    flex: 1;
    min-width: 0;
  }

  .mobile-upsell-body h3 {
    font-size: 0.9375rem;
    font-weight: 800;
    margin: 0 0 3px;
    letter-spacing: -0.01em;
  }

  .mobile-upsell-body p {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 8px;
    line-height: 1.4;
  }

  .mobile-upsell-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 4px;
  }

  .mobile-upsell-body li {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
  }

  .mobile-upsell-price {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
    min-width: 105px;
  }

  .mobile-upsell-price > span {
    font-size: 0.625rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .mobile-upsell-price > strong {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }

  .mobile-upsell-price > strong em {
    font-size: 0.75rem;
    font-weight: 500;
    font-style: normal;
    color: var(--muted);
  }

  .mobile-upsell-price .button.success {
    width: 100%;
    font-size: 0.8125rem;
    font-weight: 700;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
  }

  .mobile-upsell-price > small {
    font-size: 0.625rem;
    color: var(--muted);
    line-height: 1.5;
    font-weight: 500;
  }

  /* ── Mobile nav dropdown (hamburger) ── */
  body.mobile-nav-open .nav-links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 4;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(20, 52, 96, 0.12);
    padding: 4px 20px;
    gap: 0;
  }

  body.mobile-nav-open .nav-links a {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
  }

  body.mobile-nav-open .nav-links a:last-child {
    border-bottom: 0;
  }

  /* ── Bottom nav ── */
  body {
    padding-bottom: 72px;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 64px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(20, 52, 96, 0.08);
  }
}
