/* ============================================ */
/* RESET Y BASE                                  */
/* ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    overflow: hidden; /* Evita scroll en el html, el scroll es por secciones */
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #111111;
    color: #f0e6d2;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

/* ============================================ */
/* PANTALLA DE BIENVENIDA                        */
/* ============================================ */
.welcome-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: white;
    padding: 0;
    z-index: 10;
    overflow: hidden;
}

/* Video de fondo fullscreen */
.welcome-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

/* Capa liquid glass sobre el video */
.welcome-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.25) 40%,
        rgba(0, 0, 0, 0.45) 70%,
        rgba(0, 0, 0, 0.75) 100%
    );
    backdrop-filter: blur(3px) saturate(0.8);
    -webkit-backdrop-filter: blur(3px) saturate(0.8);
}

.welcome-content-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0 28px;
    justify-content: center;
    gap: 0;
}

.website {
    font-size: 0.75rem;
    opacity: 0.5;
    letter-spacing: 1.5px;
    text-transform: lowercase;
    margin-top: 52px;
    margin-bottom: 0;
    align-self: center;
}

.slogan-main {
    font-size: 2.4rem;
    font-weight: 300;
    line-height: 1.15;
    margin: 32px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    width: 100%;
}

.logo-container {
    margin: 36px 0 0 0;
}

.logo-welcome {
    width: 140px;
    height: auto;
    opacity: 0.95;
}

.botones-carga {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 44px;
}

.botones-carga button {
    background-color: #b22222;
    color: white;
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    letter-spacing: 0.5px;
    width: 100%;
}

.botones-carga button:active {
    background-color: #8b1a1a;
    transform: scale(0.98);
}

.direccion {
    font-size: 0.75rem;
    opacity: 0.45;
    letter-spacing: 0.5px;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 36px;
    white-space: nowrap;
}

/* ============================================ */
/* LAYOUT PRINCIPAL DE LA APP                    */
/* ============================================ */
#contenido-principal {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    inset: 0;
}

/* ============================================ */
/* ENCABEZADO DE LA APP                          */
/* ============================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background-color: #111111;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    z-index: 100;
}

.back-button {
    background-color: rgba(255,255,255,0.07);
    border: none;
    color: #f0e6d2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.back-button:active {
    background-color: rgba(255,255,255,0.15);
}

#current-date {
    flex-grow: 1;
    text-align: center;
    color: rgba(240, 230, 210, 0.6);
    font-size: 0.72rem;
    letter-spacing: 0.3px;
}

.app-logo {
    height: 34px;
    width: auto;
}

/* ============================================ */
/* SELECCIÓN DE MESA                             */
/* ============================================ */
.mesas {
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.titulo-mesas {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.5;
    margin: 0 0 10px 0;
    text-align: left;
}

.mesas-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.mesas-container::-webkit-scrollbar { display: none; }

.mesa {
    background-color: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 7px 16px;
    border-radius: 50px;
    cursor: pointer;
    color: rgba(240,230,210,0.7);
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mesa:active {
    transform: scale(0.95);
}

.mesa.seleccionada {
    background-color: #b22222;
    border-color: #b22222;
    color: white;
}

/* ============================================ */
/* CATEGORÍAS PRINCIPALES                        */
/* ============================================ */
.carta-principal {
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background-color: #111111;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.carta-principal::-webkit-scrollbar { display: none; }

.categoria-principal {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: rgba(240,230,210,0.6);
    transition: all 0.2s ease;
    padding: 8px 14px;
    border-radius: 50px;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    white-space: nowrap;
}

.categoria-principal i {
    font-size: 14px;
}

.categoria-principal span {
    font-size: 13px;
    font-weight: 500;
}

.categoria-principal.activa {
    background-color: #b22222;
    border-color: #b22222;
    color: white;
}

.categoria-principal:active {
    transform: scale(0.96);
}

/* ============================================ */
/* SUBCATEGORÍAS                                 */
/* ============================================ */
.subcarta {
    padding: 8px 16px;
    overflow-x: auto;
    background-color: #161616;
    display: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.subcarta::-webkit-scrollbar { display: none; }

.subcarta.activa {
    display: flex;
    gap: 8px;
    align-items: center;
}

.subcategoria {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: rgba(240,230,210,0.55);
    transition: all 0.2s ease;
    padding: 6px 13px;
    border-radius: 50px;
    background-color: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    white-space: nowrap;
}

.subcategoria i {
    font-size: 12px;
}

.subcategoria span {
    font-size: 12px;
    font-weight: 500;
}

.subcategoria.activa {
    background-color: rgba(178, 34, 34, 0.15);
    border-color: rgba(178, 34, 34, 0.5);
    color: #e05555;
}

.subcategoria:active {
    transform: scale(0.95);
}

/* ============================================ */
/* CONTENEDOR DE PLATOS                          */
/* ============================================ */
#categorias-contenedor {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px 80px; /* Aumentado a 80px para dar espacio al nav inferior */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#categorias-contenedor::-webkit-scrollbar { display: none; }

/* ============================================ */
/* SECCIONES Y GRILLA DE PLATOS                  */
/* ============================================ */
.platos-sub {
    display: none;
}

.platos-sub.activa {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.platos-sub h3 {
    color: rgba(240,230,210,0.5);
    margin: 4px 0 8px 2px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    grid-column: 1 / -1;
}

/* ============================================ */
/* TARJETA DE PLATO                              */
/* ============================================ */
.plato {
    background-color: #1e1e1e;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1.5px solid rgba(255,255,255,0.06);
    position: relative;
}

.plato:active {
    transform: scale(0.97);
}

.plato.seleccionado {
    border-color: #b22222;
    box-shadow: 0 0 0 2px rgba(178, 34, 34, 0.3);
}

.plato.seleccionado::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #b22222;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
    line-height: 22px;
    text-align: center;
}

/* Imagen del plato — full width, altura fija */
.plato img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Info debajo de la imagen */
.plato-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 10px 8px;
    gap: 3px;
}

.plato-info h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f0e6d2;
    line-height: 1.3;
    text-transform: none;
    /* Truncar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plato-info .descripcion {
    margin: 0;
    font-size: 0.7rem;
    color: rgba(240,230,210,0.4);
    line-height: 1.4;
    /* Truncar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plato-precio-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.plato-precio-container .precio {
    font-size: 0.88rem;
    font-weight: 700;
    color: #e05555;
    margin: 0;
    letter-spacing: 0.3px;
}

/* ============================================ */
/* BADGE CARRITO                                 */
/* ============================================ */
.nav-cart-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.nav-cart-wrapper i {
    font-size: 22px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: #e05555;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #111111;
    line-height: 1;
    animation: badgePop 0.2s ease;
}

@keyframes badgePop {
    0% { transform: scale(0.5); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================ */
/* BARRA DE NAVEGACIÓN INFERIOR                  */
/* ============================================ */
body {
    padding-bottom: 0;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #111111;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.07);
    z-index: 1000;
    flex-shrink: 0;
}

.nav-button {
    background: none;
    border: none;
    color: rgba(240,230,210,0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px 16px;
    font-family: inherit;
}

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

.nav-button:active,
.nav-button.active {
    color: #e05555;
}

/* ============================================ */
/* MODALES                                       */
/* ============================================ */

/* Ruleta */
.ruleta-modal {
    visibility: hidden;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.ruleta-contenido {
    background-color: #1e1e1e;
    padding: 28px 24px;
    border-radius: 24px;
    text-align: center;
    max-width: 90%;
    border: 1px solid rgba(255,255,255,0.1);
}

#ruleta-canvas {
    border-radius: 50%;
    border: 6px solid #b22222;
}

.selector-ruleta {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 26px solid #f0e6d2;
    z-index: 10;
}

#girar-ruleta, #cerrar-ruleta {
    background-color: #b22222;
    color: #f0e6d2;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin: 8px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
}

/* Notificación de mesa */
.mesa-notification {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.75);
    backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    z-index: 1500;
}

.mesa-notification-content {
    background: linear-gradient(135deg, #b22222, #8b1a1a);
    padding: 32px 28px;
    border-radius: 24px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

#close-notification {
    background-color: rgba(255,255,255,0.15);
    color: white;
    padding: 12px 32px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* ============================================ */
/* PÁGINA DE PEDIDOS                             */
/* ============================================ */
#pedidos-page {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#pedidos-page .detalles-pedido {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    -webkit-overflow-scrolling: touch;
}

#pedidos-page h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

#pedidos-page #tipo-pedido {
    font-size: 0.8rem;
    opacity: 0.5;
    margin: 0 0 16px 0;
}

#pedidos-page #mesa-seleccionada {
    font-size: 0.85rem;
    color: #e05555;
    margin: 0 0 20px 0;
    font-weight: 600;
}

#lista-pedidos-detalle {
    list-style: none;
    padding: 0;
    margin: 0;
}

#lista-pedidos-detalle li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 8px;
}

#lista-pedidos-detalle li .dish-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
}

#lista-pedidos-detalle li .dish-price {
    font-size: 0.85rem;
    color: #e05555;
    font-weight: 600;
    white-space: nowrap;
}

#lista-pedidos-detalle li .eliminar-plato {
    flex-shrink: 0;
    background-color: rgba(178, 34, 34, 0.15);
    color: #e05555;
    border: 1px solid rgba(178,34,34,0.3);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
    font-weight: 700;
}

#lista-pedidos-detalle li .eliminar-plato:active {
    background-color: #b22222;
    color: white;
}

/* Totales */
.subtotal-pedido,
.propina-pedido,
.total-pedido {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    opacity: 0.7;
}

.total-pedido {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f0e6d2;
    opacity: 1;
    border-bottom: none;
    padding-top: 12px;
}

#confirmar-pedido {
    background-color: #b22222;
    color: white;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: 0.5px;
    font-family: inherit;
    flex-shrink: 0;
}

#confirmar-pedido:active {
    background-color: #8b1a1a;
    transform: scale(0.99);
}

/* ============================================ */
/* ANIMACIONES Y ESTADOS GLOBALES                */
/* ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.platos-sub.activa {
    animation: fadeIn 0.2s ease forwards;
}

/* Loader */
.loader {
    position: fixed;
    inset: 0;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(178, 34, 34, 0.2);
    border-top: 4px solid #b22222;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================ */
/* UTILIDADES LEGACY (mantener compatibilidad)   */
/* ============================================ */
.botones-header { display: flex; justify-content: center; gap: 8px; }
.boton-ubicacion, .boton-ruleta, .boton-ver-pedidos, .boton-volver {
    background-color: rgba(255,255,255,0.07);
    color: #f0e6d2;
    padding: 8px 15px;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
}
