/* mobile-overrides.css
   Ajustes mobile-first para el frontend actual.
   Cargar DESPUES de tus CSS existentes.
*/

:root {
  --mobile-gutter: 16px;
  --mobile-radius: 14px;
  --header-height-mobile: 72px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== HEADER ===== */
@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px var(--mobile-gutter);
    gap: 10px;
    flex-wrap: wrap;
  }

  .logo {
    flex: 0 0 auto;
  }

  .logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
  }

  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .menu-line {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
    display: block;
  }

  .menu-principal {
    order: 3;
    width: 100%;
    flex: 0 0 100%;
  }

  .menu-principal-inner {
    padding: 0;
    width: 100%;
    max-width: none;
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .main-nav {
    display: none;
    order: 1;
    width: 100%;
  }

  .main-nav.open {
    display: block;
  }

  .main-nav .lineas-menu-principal {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    background: #104668;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 8px;
    margin-top: 8px;
  }

  .main-nav .lineas-menu-principal li,
  .header-item,
  .header-item--spacer,
  .header-item--cart,
  .header-item--contact {
    width: 100%;
    margin: 0;
  }

  .header-item--spacer {
    margin-left: 0;
  }

  .header-item--cart {
    margin-left: auto;
  }

  .lineas-menu-principal .nav-button,
  .login-button-header,
  .cart-button-header {
    width: 100%;
    min-height: 48px;
    padding: 12px 4px;
    justify-content: flex-start;
  }

  .cart-button-header {
    order: 2;
    margin-left: auto;
  }

  .header-item--cart .cart-button-header {
    justify-content: space-between;
  }

  #headerPrimaryActionText {
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
  }

  .cart-button-header .cart-icon-img {
    width: 28px;
    height: 28px;
  }
}

/* ===== HOME / INDEX ===== */
@media (max-width: 768px) {
  #root {
    max-width: 100%;
    padding: 0 12px;
  }

  .contenedor-index {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 16px;
    padding: 0 12px 20px;
    text-align: center;
  }

  .caja {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .descripcion-index {
    margin-top: 0 !important;
    margin-left: 0 !important;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .descripcion-index h1,
  .descripcion-index p {
    text-align: center;
  }

  .descripcion-index h1 {
    font-size: clamp(2rem, 10vw, 2.8rem) !important;
    line-height: 1.08;
  }

  .descripcion-index p {
    font-size: 1rem !important;
  }

  .logo-principal {
    width: 75vw !important;
    max-width: 320px;
    margin: 0 auto;
  }

  .bolsa {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .bolsa p {
    font-size: 0.95rem;
    justify-content: center;
    text-align: center;
  }

  .elige-local {
    margin-top: 0 !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .pregunta-ciudad {
    font-size: clamp(1.25rem, 5vw, 1.8rem) !important;
    line-height: 1.2;
    padding: 12px;
  }

  .pregunta-ciudad,
  .manizales-pedidos {
    text-align: center;
    width: 100%;
  }

  .manizales-pedidos {
    font-size: clamp(1.35rem, 6vw, 1.8rem) !important;
    margin-top: 20px !important;
  }

  .local-manizales {
    width: 100% !important;
    max-width: 360px;
    margin: 12px auto 0;
    border-radius: 14px;
  }

  .local-manizales:hover {
    width: 100% !important;
  }

  .local-manizales .local-manizales-texto {
    padding: 14px;
  }

  .local-manizales h3 {
    font-size: 1.1rem !important;
    line-height: 1.2;
  }

  .local-manizales p {
    font-size: 0.85rem !important;
    line-height: 1.4;
  }

  .site-footer {
    padding-left: var(--mobile-gutter);
    padding-right: var(--mobile-gutter);
  }
}

/* ===== MENU / CATEGORIAS ===== */
@media (max-width: 768px) {
  #root[data-page="app"],
  #inicio,
  #menu-root,
  #tabs-main,
  #detalles-view,
  #rellenas-view,
  #sencillas-view {
    width: 100%;
    min-width: 0;
  }

  #menu-page {
    width: 100%;
    max-width: 430px;
    min-width: 0;
    margin: 0 auto 20px !important;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .promo-hint {
    font-size: 15px;
    line-height: 1.3;
    text-align: center;
    padding-bottom: 10px;
  }

  .tabs-wrapper,
  .tab-contenido,
  .tab-contenido.active,
  .pizzas-block,
  .subtabs-content,
  .cards-list {
    width: 100%;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
  }

  .hero {
    margin-top: 12px;
    padding: 14px 12px;
    border-radius: 14px 14px 0 0;
  }

  .hero h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
    line-height: 1.1;
  }

  .nav-categorias,
  #nav-main,
  .subtabs-wrap,
  .subtabs,
  .tabs-main,
  .tabs-scroll {
    width: 100%;
    min-width: 0;
  }

  .nav-categorias,
  #nav-main,
  .subtabs,
  .tabs-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px var(--mobile-gutter) 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav-categorias > *,
  #nav-main > *,
  .subtabs > *,
  .tabs-scroll > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .cards-list {
    gap: 14px;
  }

  .card-item {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
  }

  .card-img {
    width: 100%;
    flex: 0 0 auto;
  }

  .card-img img {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    object-fit: cover;
  }

  .card-content {
    gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .card-header {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .card-badge {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  .card-desc {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .card-title,
  .card-badge,
  .card-desc,
  .card-variant-label,
  .card-price-row {
    text-align: center;
  }

  .card-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
  }

  .card-variant-select {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    font-size: 1rem;
  }

  .card-variant-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    text-align: center;
  }

  .card-variant-label {
    font-size: 1rem;
  }

  .card-price {
    margin-left: 0;
    font-size: 1.55rem;
  }

  .card-price-before {
    font-size: 1rem;
    margin-right: 0;
  }

  .card-price-now {
    margin-left: 0;
  }

  .card-buttons {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
  }

  .btn-elegir,
  .btn-combinar,
  .btn-primary,
  .btn-secondary {
    width: 100%;
    min-height: 46px;
    font-size: 1rem;
  }

  .combine-bar {
    top: var(--header-height-mobile);
    padding: 10px var(--mobile-gutter);
  }

  .combine-summary {
    width: 100%;
    padding: 12px;
  }

  .combine-size {
    font-size: 1.15rem;
  }

  .combine-flavor,
  .combine-price {
    font-size: 1rem;
  }

  .pizzas-subnav-title {
    font-size: 15px;
  }
}

/* ===== DETALLE PRODUCTO Y VISTAS INTERNAS ===== */
@media (max-width: 768px) {
  #detalles-view .card-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }

  #detalles-view .card-img {
    width: 96px !important;
    min-width: 96px !important;
    flex: 0 0 96px !important;
  }

  #detalles-view .card-img img {
    width: 96px !important;
    height: 96px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
  }

  #detalles-view .card-content {
    flex: 1 !important;
    min-width: 0 !important;
    width: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    text-align: left !important;
  }

  #detalles-view .card-header {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    text-align: left !important;
  }

  #detalles-view .card-title,
  #detalles-view .card-desc,
  #detalles-view .card-price,
  #detalles-view .card-price-row,
  #detalles-view .card-buttons,
  #detalles-view .card-variant-row,
  #detalles-view .card-variant-label,
  #detalles-view .dp-combo-inline-right {
    text-align: left !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    margin-left: 0 !important;
  }

  .dp-shell,
  .dp-layout,
  .dp-main,
  .dp-sidebar,
  .dp-card,
  .dp-summary,
  .dp-section,
  .detalle-producto,
  .detalle-layout,
  .detalle-info,
  .detalle-aside {
    width: 100%;
    min-width: 0;
  }

  .dp-layout,
  .detalle-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .dp-gallery img,
  .detalle-producto img,
  .detalle-imagen img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 14px;
  }

  #detalles-view .dp-summary__flavor-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }

  #detalles-view .dp-summary__thumb {
    width: 96px !important;
    height: 96px !important;
    flex: 0 0 96px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
  }

  #detalles-view .dp-summary__flavor-text {
    flex: 1 !important;
    min-width: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .dp-add-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .dp-field--adicion,
  .dp-field--place {
    flex: 1 1 100%;
  }

  .dp-field--qty {
    flex: 0 0 auto;
  }

  .dp-field--price {
    flex: 1 1 auto;
  }

  .dp-single-line {
    flex-direction: column;
    align-items: stretch;
  }

  .dp-single-controls {
    justify-content: flex-end;
  }

  /* ✅ El texto del extra (ej. "Extra de Queso crema") se lee completo en móvil:
     se permite que baje de línea en vez de cortarse con "..." */
  .dp-single-header {
    flex-wrap: wrap !important;   /* el precio baja a otra línea si no cabe */
    row-gap: 2px;
  }

  .dp-single-title {
    white-space: normal !important;   /* permite varias líneas */
    overflow: visible !important;     /* no recorta */
    text-overflow: clip !important;   /* sin puntos suspensivos */
    overflow-wrap: anywhere;          /* parte palabras muy largas si hiciera falta */
    word-break: break-word;
    line-height: 1.2;
  }

  #detalles-view .dp-actions,
  .detalle-acciones,
  .dp-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #detalles-view .dp-actions > *,
  .detalle-acciones > *,
  .dp-footer-actions > * {
    width: 100%;
  }

  #detalles-view .dp-qty-label {
    margin-bottom: 0 !important;
    gap: 8px !important;
  }

  #detalles-view .qty__label {
    font-size: 16px !important;
    text-align: left !important;
  }

  #detalles-view .qty__control {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 48px 1fr 48px !important;
    align-items: center !important;
  }

  #detalles-view .qty__btn {
    width: 48px !important;
    height: 48px !important;
    font-size: 22px !important;
  }

  #detalles-view .qty__input {
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    font-size: 22px !important;
  }

  #detalles-view .btn-elegir {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 18px !important;
  }
}

/* ===== SCROLL DE CATEGORIAS DE PIZZA ===== */
@media (max-width: 768px) {
  #detalles-view .subtabs-wrap,
  #menu-root .subtabs-wrap,
  .pizzas-block .subtabs-wrap {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 12px 12px 12px !important;
    box-sizing: border-box !important;
    scroll-snap-type: x proximity;
  }

  #detalles-view .subtabs-wrap .subtab-btn,
  #menu-root .subtabs-wrap .subtab-btn,
  .pizzas-block .subtabs-wrap .subtab-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    min-width: max-content !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    scroll-snap-align: start;
  }
}

/* ===== CARRITO ===== */
@media (max-width: 900px) {
  main.carrito-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #root {
    padding: 0 var(--mobile-gutter);
  }

  main.carrito-layout {
    padding: 1rem 0 2rem;
    gap: 1rem;
  }

  .carrito-titulo {
    font-size: 1.4rem;
    line-height: 1.15;
    border-radius: 14px 14px 0 0;
  }

  .carrito-subtitulo {
    font-size: 0.95rem;
    line-height: 1.4;
    padding-top: 8px;
    border-radius: 0 0 14px 14px;
  }

  .carrito-item-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .carrito-item-media {
    width: 100%;
    height: 200px;
  }

  .carrito-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .carrito-item-actions {
    justify-content: flex-end;
  }

  .carrito-resumen {
    position: static;
    padding: 1rem;
  }

  .botones-confirmacion {
    flex-direction: column;
    gap: 10px;
  }

  .botones-confirmacion button,
  .carrito-btn-recoger,
  .carrito-btn-domicilio,
  .dp-back-carrito {
    width: 100%;
  }

  .carrito-btn-recoger,
  .carrito-btn-domicilio,
  .dp-back-carrito {
    min-height: 52px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 0.98rem;
    line-height: 1.3;
  }

  .botones-confirmacion button img {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 600px) {
  .carrito-item-card {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .carrito-item-media {
    width: 84px;
    height: 84px;
  }

  .carrito-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* ===== LOGIN / REGISTRO ===== */
@media (max-width: 768px) {
  body {
    min-height: 100vh;
  }

  .login-container,
  .register-container,
  #login-form,
  #register-form,
  #login-form input,
  #register-form input,
  #login-form button,
  #register-form button {
    box-sizing: border-box !important;
  }

  main.login-container,
  main.register-container {
    width: 100% !important;
    max-width: 420px !important;
    margin: 16px auto !important;
    padding: 22px 18px !important;
    border-radius: 16px;
  }

  #login-form,
  #register-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #login-form input,
  #register-form input {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px;
    padding: 12px !important;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    display: block !important;
  }

  #login-form button,
  #register-form button {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    gap: 10px;
  }

  #googleLoginBtn,
  #googleRegisterBtn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    min-height: 56px !important;
  }

  #googleLoginBtn img,
  #googleRegisterBtn img {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    object-fit: contain !important;
    display: block !important;
  }
}

/* ===== PANELES OPERATIVOS ===== */
@media (max-width: 768px) {
  main {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow-x: hidden;
  }

  #pedidos article,
  article[style*="border:1px solid #ccc"] {
    border-radius: 14px;
  }

  #pedidos button,
  article button {
    display: block;
    width: 100%;
    margin: 8px 0 0;
    min-height: 44px;
  }

  #pedidos input,
  article input {
    width: 100%;
    min-height: 44px;
    margin-top: 8px;
  }
}

/* === Carrito responsive fuera del menú hamburguesa === */
.header-cart-mobile { display: none; }            /* escritorio: oculto */

@media (max-width: 768px) {
  .header-cart-mobile {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    order: 0;
    flex: 0 0 auto;
    width: auto !important;
    min-height: 44px;
    margin-left: auto !important;   /* empuja el carrito a la derecha, junto al hamburguesa */
    margin-right: -8px !important;  /* separación fina respecto al hamburguesa (ver nota) */
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }
  .header-cart-mobile .cart-icon-img { width: 28px !important; height: 28px !important; }

  /* Clave: el hamburguesa deja de empujarse solo, así el carrito queda pegado a él */
  .menu-toggle { margin-left: 0 !important; }

  /* El carrito de adentro del menú sigue oculto en móvil */
  .header-item--cart { display: none !important; }
}