/* =========================================================
   PREORDEN PALCOS — CAPA MÓVIL PREMIUM
   Cárgala DESPUÉS del CSS actual de cada página.
   Solo modifica pantallas de 760px o menos.
   ========================================================= */

@media (max-width: 760px) {
  :root {
    --mobile-gutter: 18px;
    --mobile-radius-xl: 24px;
    --mobile-radius-lg: 20px;
    --mobile-radius-md: 16px;
    --mobile-shadow: 0 18px 44px rgba(8, 29, 56, 0.13);
    --mobile-shadow-soft: 0 10px 28px rgba(8, 29, 56, 0.09);
  }

  html {
    min-width: 320px;
    background: #f1f5fa;
    scroll-behavior: smooth;
  }

  body {
    width: 100%;
    min-width: 320px;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
      "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  }

  button,
  a,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  button,
  .stadium-card,
  .event-card,
  .producto-card,
  .order-ticket {
    -webkit-tap-highlight-color: transparent;
  }

  /* -------------------------------------------------------
     SELECTOR DE ESTADIO
     ------------------------------------------------------- */

  .selector-shell {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: 680px;
    min-height: 100dvh;
    margin: 0 auto;
    padding:
      max(14px, env(safe-area-inset-top))
      0
      max(30px, env(safe-area-inset-bottom));
  }

  .selector-navbar {
    min-height: 66px;
    padding: 11px 14px;
    border-radius: 22px;
    gap: 10px;
    box-shadow: 0 14px 34px rgba(8, 29, 56, 0.22);
  }

  .selector-brand {
    min-width: 0;
    gap: 10px;
  }

  .selector-brand img {
    width: 116px;
    max-width: 45vw;
    max-height: 38px;
  }

  .selector-brand span {
    display: none;
  }

  .staff-access {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.11);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .staff-access span {
    display: none;
  }

  .staff-access i {
    font-size: 21px;
  }

  .selector-main {
    padding: 42px 0 30px;
  }

  .selector-copy {
    max-width: 540px;
    margin: 0 auto 28px;
    padding: 0 3px;
  }

  .selector-eyebrow {
    padding: 8px 13px;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.11em;
  }

  .selector-copy h1 {
    max-width: 560px;
    margin: 17px auto 12px;
    font-size: clamp(36px, 10vw, 48px);
    line-height: 0.98;
    letter-spacing: -1.9px;
    text-wrap: balance;
  }

  .selector-copy p {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 4px;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 650;
    text-wrap: pretty;
  }

  .stadium-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .stadium-form {
    width: 100%;
    min-width: 0;
  }

  .stadium-card {
    width: 100%;
    height: min(78vw, 330px);
    min-height: 286px;
    border-radius: 26px;
    box-shadow: var(--mobile-shadow);
  }

  .stadium-card:active {
    transform: scale(0.985);
  }

  .stadium-cover {
    background-position: center 42%;
  }

  .stadium-overlay {
    background:
      linear-gradient(180deg, rgba(4, 15, 31, 0.04) 0%, rgba(4, 15, 31, 0.16) 34%,
      color-mix(in srgb, var(--card-primary) 80%, #020912) 100%);
  }

  .stadium-content {
    padding: 22px;
  }

  .stadium-logo-wrap {
    min-width: 72px;
    max-width: 174px;
    height: 55px;
    padding: 9px 13px;
    border-radius: 17px;
  }

  .stadium-logo-wrap img {
    max-width: 146px;
    max-height: 36px;
  }

  .current-badge {
    top: 22px;
    right: 21px;
    min-height: 30px;
    padding: 7px 10px;
    font-size: 9px;
  }

  .stadium-text small {
    font-size: 10px;
  }

  .stadium-text strong {
    max-width: 100%;
    margin-top: 7px;
    font-size: clamp(29px, 8.5vw, 38px);
    line-height: 1;
    letter-spacing: -1.25px;
    text-wrap: balance;
  }

  .stadium-text > span {
    margin-top: 10px;
    font-size: 14px;
  }

  .stadium-action {
    margin-top: 20px;
    padding-top: 16px;
    font-size: 14px;
  }

  .stadium-action i {
    font-size: 27px;
  }

  .selector-message {
    padding: 20px 17px;
    border-radius: 20px;
    line-height: 1.45;
  }

  .selector-footer {
    min-height: 58px;
    margin-top: 4px;
    padding: 12px 16px;
    border-radius: 20px;
  }

  /* -------------------------------------------------------
     ENCABEZADOS PÚBLICOS / NAVEGACIÓN TIPO APP
     ------------------------------------------------------- */

  .events-navbar,
  .orders-navbar {
    display: none !important;
  }

  .mobile-top-bar {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: 680px;
    min-height: 62px;
    margin:
      max(12px, env(safe-area-inset-top))
      auto
      16px;
    padding: 10px 13px;
    border-radius: 21px;
    box-shadow: 0 14px 34px rgba(8, 29, 56, 0.20);
  }

  .mobile-top-bar img {
    height: 35px;
    max-width: 145px;
  }

  .mobile-stadium-switch,
  .mobile-top-spacer {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 14px;
  }

  .mobile-stadium-switch {
    border: 1px solid rgba(255, 255, 255, 0.10);
  }

  .bottom-nav {
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    padding: 8px 6px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(8, 29, 56, 0.18);
    overflow: hidden;
  }

  .bottom-nav-item {
    min-height: 48px;
    border-radius: 15px;
    font-size: 9px;
    letter-spacing: 0.02em;
  }

  .bottom-nav-item i {
    font-size: 22px;
  }

  .bottom-nav-item.active {
    background: color-mix(in srgb, var(--red) 9%, #fff);
  }

  body:has(.bottom-nav) {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  /* -------------------------------------------------------
     EVENTOS
     ------------------------------------------------------- */

  .events-page {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: 680px;
    margin: 0 auto;
    padding: 12px 0 26px;
  }

  .events-top {
    width: 100%;
    margin: 0 0 16px;
    padding: 0 2px;
  }

  .events-top .eyebrow,
  .events-top .see-all {
    margin: 0;
  }

  .events-top .eyebrow {
    max-width: 67%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .slider-bar {
    margin-bottom: 18px;
  }

  .events-grid,
  .events-grid.cards-1,
  .events-grid.cards-2 {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .event-card {
    width: 100%;
    border-radius: 24px;
    box-shadow: var(--mobile-shadow-soft);
  }

  .event-card:active {
    transform: scale(0.99);
  }

  .event-art {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #e9eef5;
  }

  .event-art img {
    object-fit: cover;
    object-position: center;
  }

  .event-info {
    padding: 15px;
  }

  .buy-btn {
    min-height: 50px;
    border-radius: 16px;
    font-size: 13px;
    letter-spacing: 0.07em;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--red) 24%, transparent);
  }

  .loading-state {
    min-height: 290px;
  }

  .kai-footer {
    width: 100%;
    margin: 28px auto 8px;
    padding: 14px 18px;
    border-radius: 20px;
  }

  /* -------------------------------------------------------
     MENÚ / PEDIDO
     ------------------------------------------------------- */

  .pedido-navbar {
    width: calc(100% - (var(--mobile-gutter) * 2)) !important;
    max-width: 680px;
    min-height: 62px;
    margin:
      max(12px, env(safe-area-inset-top))
      auto
      0 !important;
    padding: 10px 13px !important;
    border-radius: 21px !important;
    top: 10px !important;
    box-shadow: 0 14px 34px rgba(8, 29, 56, 0.20);
  }

  .pedido-navbar .brand img {
    width: 112px;
  }

  .pedido-navbar .brand span,
  .pedido-navbar .nav-actions a span {
    display: none;
  }

  .pedido-navbar .nav-actions {
    gap: 6px;
  }

  .pedido-navbar .nav-actions a {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.11);
  }

  .pedido-page {
    padding: 14px 0 24px;
  }

  .pedido-header,
  .pedido-content {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }

  .pedido-header {
    margin-bottom: 14px;
    padding: 19px;
    border-radius: 22px;
    box-shadow: var(--mobile-shadow-soft);
  }

  .pedido-header h1 {
    font-size: clamp(29px, 8vw, 38px);
    line-height: 1;
    letter-spacing: -1px;
  }

  .pedido-header p {
    font-size: 14px;
    line-height: 1.5;
  }

  .pedido-content {
    display: block;
  }

  .panel,
  .carrito {
    padding: 17px;
    border-radius: 22px;
    box-shadow: var(--mobile-shadow-soft);
  }

  .panel h2,
  .carrito h2 {
    font-size: 20px;
  }

  .section-head {
    margin-bottom: 15px;
  }

  .filter-row {
    gap: 10px;
    margin-bottom: 13px;
  }

  .filter-toggle {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 14px;
  }

  .active-filter-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .category-filters.open {
    display: flex;
    gap: 9px;
    margin: 0 -2px 16px;
    padding: 2px 2px 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .category-filters.open::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 14px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .productos-grid {
    width: 100%;
    gap: 0;
  }

  .producto-card {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    min-height: 124px;
    margin-bottom: 13px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 9px 24px rgba(8, 29, 56, 0.08);
  }

  .producto-card:active {
    transform: scale(0.992);
  }

  .producto-img {
    width: 104px;
    height: 100%;
    min-height: 124px;
    padding: 10px;
    background: linear-gradient(145deg, #f6f8fb, #edf2f7);
  }

  .producto-img img {
    max-width: 88%;
    max-height: 88%;
  }

  .producto-body {
    min-width: 0;
    padding: 14px 13px;
  }

  .producto-body h3 {
    font-size: 15px;
    line-height: 1.18;
    text-wrap: pretty;
  }

  .producto-body p {
    display: -webkit-box;
    margin: 5px 0 10px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .producto-bottom {
    align-items: center;
    gap: 8px;
  }

  .price {
    font-size: 16px;
  }

  .qty-stepper,
  .qty-controls {
    gap: 5px;
    padding: 4px;
  }

  .qty-btn,
  .qty-controls button {
    width: 30px;
    height: 30px;
  }

  .view-package-btn {
    max-width: 100%;
    min-height: 36px;
    padding: 8px 11px;
    font-size: 11px;
    white-space: normal;
    text-align: center;
  }

  .mobile-cart-fab {
    right: 18px !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    width: 58px;
    height: 58px;
    border-radius: 19px;
    box-shadow: 0 16px 34px color-mix(in srgb, var(--red) 34%, transparent);
  }

  .clear-filter-fab {
    bottom: calc(96px + env(safe-area-inset-bottom));
    max-width: calc(100% - 36px);
  }

  .carrito.mobile-open {
    width: calc(100% - 24px) !important;
    max-width: 540px;
    max-height: calc(100dvh - 24px);
    margin: 12px;
    padding: 20px;
    border-radius: 25px 25px 0 0;
  }

  .modal-card {
    width: calc(100% - 24px);
    max-width: 560px;
    max-height: calc(100dvh - 28px);
    margin: 14px auto;
    padding: 20px;
    border-radius: 25px;
  }

  .modal-head {
    align-items: flex-start;
    gap: 12px;
  }

  .modal-close {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .check-card,
  .service-box,
  .pago-card {
    border-radius: 18px;
  }

  .confirm-btn,
  .seguir-btn {
    min-height: 50px;
    border-radius: 16px;
  }

  /* -------------------------------------------------------
     MIS PEDIDOS
     ------------------------------------------------------- */

  .orders-page {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: 680px;
    margin: 0 auto;
    padding: 4px 0 28px;
  }

  .orders-hero {
    padding: 19px;
    border-radius: 23px;
    box-shadow: var(--mobile-shadow-soft);
  }

  .orders-hero h1 {
    font-size: clamp(31px, 9vw, 41px);
    line-height: 1;
    letter-spacing: -1.2px;
  }

  .orders-hero p {
    font-size: 14px;
    line-height: 1.45;
  }

  .search-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 6px;
    padding: 9px;
    border-radius: 18px;
  }

  .search-card button {
    grid-column: 1 / -1;
    min-height: 47px;
    border-radius: 14px;
  }

  .orders-status {
    margin: 14px 0;
    padding: 15px;
    border-radius: 18px;
  }

  .orders-grid,
  .orders-track {
    width: 100%;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .orders-track .order-ticket {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .order-ticket {
    border-radius: 24px;
    box-shadow: var(--mobile-shadow-soft);
  }

  .ticket-head,
  .ticket-body {
    padding: 17px;
  }

  .ticket-top {
    gap: 10px;
  }

  .ticket-folio {
    font-size: 19px;
  }

  .badge {
    padding: 6px 8px;
    font-size: 9px;
  }

  .ticket-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }

  .meta-item {
    padding: 10px;
    border-radius: 14px;
  }

  .command-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    font-size: 13px;
  }

  /* Evita que elementos largos rompan el ancho en WebView. */
  img,
  svg,
  video,
  canvas {
    max-width: 100%;
  }

  input,
  select,
  textarea {
    max-width: 100%;
    font-size: 16px; /* evita zoom automático en iPhone */
  }
}

@media (max-width: 390px) {
  :root {
    --mobile-gutter: 15px;
  }

  .selector-main {
    padding-top: 34px;
  }

  .selector-copy h1 {
    font-size: 35px;
  }

  .stadium-card {
    min-height: 278px;
  }

  .stadium-content {
    padding: 19px;
  }

  .stadium-text strong {
    font-size: 29px;
  }

  .producto-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .producto-img {
    width: 92px;
  }
}

/* ══════════════════════════════════════
   FEEDBACK JEFE — AJUSTES FINALES MÓVIL
══════════════════════════════════════ */
@media (max-width: 760px) {
  .mobile-top-bar img {
    width: min(46vw, 154px);
    height: auto;
    max-height: 35px;
    object-fit: contain;
  }

  .carrito,
  .carrito.mobile-open {
    left: 50% !important;
    right: auto !important;
    width: calc(100% - 24px) !important;
    max-width: 540px !important;
    margin: 0 !important;
  }

  .carrito {
    transform: translate(-50%, 120%) !important;
  }

  .carrito.mobile-open {
    transform: translate(-50%, 0) !important;
  }
}
