/* ================================================================
   responsive.css — Jama App
   Estilos responsive: tablet (768px) y móvil (480px)
   ================================================================ */

/* ================================================================
   TABLET — max-width: 1024px
   ================================================================ */
@media (max-width: 1024px) {
  :root {
    --content-pad: 1.5rem;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-visual { display: none; }

  .hero-subtitle { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-benefits { justify-content: center; }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
  .footer-brand { grid-column: 1 / -1; }
}

/* ================================================================
   TABLET — max-width: 768px
   ================================================================ */
@media (max-width: 768px) {
  /* UX-05: ampliar el área táctil sin agrandar el icono visible. */
  .icon-btn,
  .nav-icon-btn,
  .btn-icon,
  .product-heart,
  .btn-add,
  .cart-close,
  .modal-close,
  .auth-modal-close,
  .auth-pass-toggle,
  .search-clear,
  .qty-btn,
  #orders-close-btn,
  .btn-back,
  .rest-fav-btn,
  .btn-close-cart,
  .btn-qty,
  .ff-tab-close,
  .ff-mute-btn,
  .ff-comments-close,
  .ff-comment-send,
  .ff-product-add,
  .pf-navbar-btn,
  .pf-addr-btn,
  .pf-upload-video-remove,
  .pf-player-close,
  .pf-player-menu-btn {
    min-width: 44px;
    min-height: 44px;
  }
  :root {
    --header-h: 64px;
    --content-pad: 1.25rem;
  }

  /* ── HEADER MOBILE — estilo app ── */
  :root { --header-h: 56px; }

  #main-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(255,255,255,0.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 1px 0 var(--color-line), 0 2px 12px rgba(25,19,15,.05);
  }

  .header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    gap: 0;
  }

  /* Logo solo icono en mobile → en realidad lo ocultamos del todo:
     en su lugar va el selector de dirección */
  .logo { display: none; }

  .mobile-location-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 46vw;
    min-width: 0;
    padding: 0;
    color: var(--color-dark);
    font-weight: 800;
    font-size: var(--text-base);
  }
  .mobile-location-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-location-chevron {
    width: 16px; height: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--transition-fast);
  }
  .mobile-location-chevron svg { width: 100%; height: 100%; }
  .mobile-location-btn.open .mobile-location-chevron { transform: rotate(180deg); }

  /* Ocultar búsqueda del navbar — usaremos la barra mobile debajo */
  .header-search { display: none; }
  .header-left { gap: 0; }

  /* Ocultar botones de texto en navbar */
  .btn-restaurant-panel { display: none; }
  .nav-actions #nav-login-btn { display: none; }
  #mobile-menu-toggle  { display: none; }

  /* FoodFeed sigue accesible desde el navbar en mobile: versión con
     ícono (mismo SVG que el nav inferior) en vez del logo a color */
  .btn-foodfeed { display: none !important; }
  .btn-foodfeed-mobile {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    color: var(--color-dark);
    flex-shrink: 0;
  }
  .btn-foodfeed-mobile > span {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
  }
  .btn-foodfeed-mobile svg { width: 100%; height: 100%; }

  /* Ya no hace falta: el perfil se abre desde el nav inferior */
  .nav-user-avatar { display: none !important; }

  /* Solo mostrar: foodfeed + cart */
  .nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .cart-toggle {
    width: auto; height: auto;
    background: none;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    transition: transform var(--transition-fast);
  }
  .cart-toggle:active { transform: scale(0.9); }
  .cart-toggle-icon {
    width: 24px; height: 24px;
    color: var(--color-dark);
    display: flex; align-items: center; justify-content: center;
  }
  .cart-toggle-icon svg { width: 100%; height: 100%; }

  /* Barra de búsqueda mobile — sticky bajo el header */
  .mobile-search-bar {
    display: flex;
    position: sticky;
    top: var(--header-h);
    margin-top: var(--header-h);
    z-index: 190;
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    padding: 8px var(--space-4);
    border-bottom: 1px solid var(--color-line);
    box-shadow: 0 2px 10px rgba(25,19,15,.05);
  }

  .mobile-search-wrap {
    display: flex;
    align-items: center;
    background: var(--color-bg-2);
    border: 1.5px solid var(--color-line);
    border-radius: var(--radius-full);
    padding: 7px var(--space-4);
    gap: var(--space-2);
    width: 100%;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  }
  .mobile-search-wrap:focus-within {
    border-color: var(--color-red);
    background: white;
    box-shadow: var(--ring-red);
  }
  .mobile-search-wrap input {
    flex: 1; border: none; outline: none;
    background: transparent;
    font-size: var(--text-sm);
    font-family: var(--font-body);
    color: var(--color-dark);
    padding: 0;
  }
  .mobile-search-wrap input::placeholder { color: var(--color-gray-3); }
  .mobile-search-icon {
    width: 17px; height: 17px; flex-shrink: 0;
    color: var(--color-gray-3);
    display: flex; align-items: center; justify-content: center;
  }
  .mobile-search-icon svg { width: 100%; height: 100%; }

  /* Ocultar hero grande en mobile */
  .hero { display: none; }

  /* Sin footer en mobile — se ve como app, no como sitio web */
  .footer { display: none; }

  .categories-section { padding-block: var(--space-4) var(--space-2); }

  /* main ya no necesita compensar el header: la search bar (con su
     propio margin-top) es quien se encarga de eso */
  main { padding-top: 0; }

  /* Ocultar mobile-menu hamburguesa */
  #mobile-menu { display: none !important; }

  /* Hero */
  .hero { padding-block: var(--space-12) var(--space-16); }
  .hero-title { font-size: clamp(2.5rem, 10vw, 4rem); }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .btn { width: 100%; max-width: 320px; }
  .hero-benefits {
    gap: var(--space-6);
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Secciones */
  .section { padding-block: var(--space-12); }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
  }

  /* Categorías */
  .category-btn {
    padding: var(--space-3) 6px;
    width: 100px;
  }
  .cat-emoji { font-size: 1.5rem; }

  /* Featured grid — sigue siendo carrusel horizontal en tablet */
  #featured-grid {
    gap: var(--space-3);
  }

  /* Restaurantes — sigue siendo carrusel horizontal en mobile */
  #restaurants-grid {
    gap: var(--space-3);
  }

  /* Jama del día — se mantiene horizontal (info izq. / foto der.) en mobile también */
  .jdd-stack { height: 370px; }
  .jdd-info { padding: var(--space-4) var(--space-3); }
  .jdd-media { width: 54%; padding: 2px; }
  .jdd-emoji { font-size: 3rem; }
  .jdd-name {
    font-size: var(--text-xl);
    line-height: 1.08;
  }
  .jdd-badge { margin-bottom: var(--space-3); }
  .jdd-desc { font-size: 12px; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: var(--space-3); }
  .jdd-btn { padding: 10px var(--space-4); font-size: 13px; }
  .jdd-bottom-row { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .jdd-price { font-size: var(--text-2xl); }

  /* Promos */
  #promos-grid { grid-template-columns: 1fr 1fr; }

  /* Historial */
  #history-list { grid-template-columns: 1fr; }

  /* Modal restaurante */
  #restaurant-modal .modal-sheet {
    max-height: 98vh;
    margin: 0;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    width: 100%;
  }
  .modal-info-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .modal-meta-row {
    grid-template-columns: 1fr 1fr;
    display: grid;
    gap: var(--space-3);
  }

  /* Modal extras */
  #extras-modal .modal-sheet {
    max-width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    margin: 0;
    width: 100%;
  }
  #extras-modal {
    align-items: flex-end;
  }

  /* Checkout */
  #checkout-modal .modal-sheet {
    max-width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    margin: 0;
    width: 100%;
    max-height: 96vh;
  }
  #checkout-modal { align-items: flex-end; }
  .radio-group { grid-template-columns: 1fr; }

  /* Confirmación */
  #order-confirm-modal .modal-sheet {
    max-width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    margin: 0;
    width: 100%;
  }
  #order-confirm-modal { align-items: flex-end; }

  /* Cart */
  #cart-panel { width: 100%; }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .footer-brand { grid-column: auto; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }
}

/* ================================================================
   MÓVIL — max-width: 480px
   ================================================================ */
@media (max-width: 480px) {
  :root {
    --content-pad: 1rem;
  }

  /* Promos: columna única */
  #promos-grid { grid-template-columns: 1fr; }

  /* Hero más compacto */
  .hero { padding-block: var(--space-10) var(--space-12); }
  .hero-label { font-size: var(--text-xs); }
  .hero-subtitle { font-size: var(--text-base); }

  .hero-search-wrapper {
    flex-wrap: wrap;
    border-radius: var(--radius-xl);
    gap: var(--space-3);
  }
  .hero-search-icon { padding-left: var(--space-2); }
  .hero-search-btn {
    width: 100%;
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    text-align: center;
  }

  /* Cart: footer compacto */
  .cart-actions { flex-direction: column; }

  /* Product items compactos */
  .product-item {
    flex-direction: column;
  }
  .product-cover-mini {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-md);
  }

  /* Extras: grid compacto */
  .extras-actions { flex-direction: column; }

  /* Checkout: pagos en columna */
  .radio-group.payment-options {
    grid-template-columns: 1fr 1fr;
  }

  /* Toast más pequeño */
  .jama-toast {
    font-size: var(--text-xs);
    padding: var(--space-3) var(--space-4);
    bottom: 16px;
  }

  /* Secciones más ajustadas */
  .section { padding-block: var(--space-10); }
  .section-title { font-size: var(--text-2xl); }
}

/* ================================================================
   SCROLLBAR PERSONALIZADA (navegadores que la soporten)
   ================================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-gray-4);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-3);
}

/* ================================================================
   FOCUS VISIBLE — Accesibilidad
   ================================================================ */
:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}


/* ================================================================
   BOTTOM NAVIGATION — solo mobile (≤768px)
   ================================================================ */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
    z-index: 300;
    box-shadow: 0 -4px 24px rgba(25,19,15,0.07);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2) 0;
    min-height: 56px;
    transition: color var(--transition-fast);
    color: var(--color-gray-3);
    font-family: var(--font-body);
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-item:active .mobile-nav-icon { transform: scale(0.85); }

  .mobile-nav-icon {
    width: 23px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s cubic-bezier(0.34,1.56,0.64,1);
  }
  .mobile-nav-icon svg { width: 100%; height: 100%; }

  .mobile-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
  }

  .mobile-nav-item.active {
    color: var(--color-red);
  }

  .mobile-nav-item.active .mobile-nav-icon {
    transform: scale(1.15) translateY(-1px);
  }

  /* Empujar contenido sobre el bottom nav */
  main, body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }

  /* Floating button (pedido activo) sube sobre el bottom nav */
  #active-order-btn {
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
  }
}

/* Desktop: ocultar bottom nav y mobile search bar */
@media (min-width: 769px) {
  .mobile-bottom-nav { display: none; }
  .mobile-search-bar  { display: none; }
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  #main-header, #cart-panel, .modal, .jama-toast { display: none !important; }
}
