/* ==========================================================================
   🍟 SR. PAPA - SISTEMA DE DISEÑO & UI/UX CORPORATIVO
   Inspirado en la paleta oficial del Logo:
   - Amarillo Papa Dorado: #FFB800 / #F5A623 / #FFC83B
   - Azul Marino Real Profundo: #071638 / #0D2253 / #112A66
   - Azul Letras Sr. Papa: #1565C0 / #1E88E5
   - Acentos: Verde Esmeralda (#10B981) y Rojo (#EF4444)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
    --sp-yellow-primary: #FFB800;
    --sp-yellow-hover: #FFA000;
    --sp-yellow-light: #FFE082;
    --sp-yellow-glow: rgba(255, 184, 0, 0.35);

    --sp-blue-darkest: #061129;
    --sp-blue-bg: #081636;
    --sp-blue-surface: #0c204d;
    --sp-blue-surface-hover: #122c66;
    --sp-blue-card: #0e2254;
    --sp-blue-border: #1a3c7d;
    --sp-blue-border-light: rgba(66, 165, 245, 0.25);

    --sp-brand-blue: #1565C0;
    --sp-brand-blue-light: #38bdf8;

    --sp-text-main: #FFFFFF;
    --sp-text-muted: #9BB0D3;
    --sp-text-dark: #071638;

    --sp-green: #10B981;
    --sp-green-hover: #059669;
    --sp-red: #EF4444;
    --sp-red-hover: #DC2626;

    --sp-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --sp-radius-sm: 8px;
    --sp-radius-md: 12px;
    --sp-radius-lg: 18px;
    --sp-radius-xl: 24px;
}

/* ESTILOS GLOBALES */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--sp-font);
    background-color: var(--sp-blue-bg);
    color: var(--sp-text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* SCROLLBAR MODERNO */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(7, 22, 56, 0.6);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: var(--sp-blue-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--sp-yellow-primary);
}

/* EFECTOS Y UTILIDADES */
.brand-glow {
    box-shadow: 0 0 25px var(--sp-yellow-glow);
}

.brand-border {
    border: 2px solid var(--sp-yellow-primary);
}

/* BOTONES TÁCTILES */
.btn-touch {
    font-family: var(--sp-font);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-touch:active {
    transform: scale(0.97);
}

/* ==========================================================================
   📱 ADAPTABILIDAD RESPONSIVA MULTI-DISPOSITIVO (MÓVIL, TABLET, LAPTOP)
   ========================================================================== */

/* Contenedor de pestañas táctiles con soporte de desplazamiento horizontal */
.nav-tabs-pos {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    width: 100%;
    position: relative;
    z-index: 5;
}

/* 1. TABLET Y PANTALLAS MEDIANAS (hasta 1024px) */
@media (max-width: 1024px) {
    html, body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        padding: 12px !important;
    }

    .pos-maestro-layout {
        height: auto !important;
        min-height: calc(100vh - 24px) !important;
        gap: 14px !important;
    }

    .columna-factura-derecha {
        width: 330px !important;
        min-width: 320px !important;
    }

    /* Grillas de productos en 3 columnas para tablet */
    #section-principales,
    #section-postres,
    .cuadricula-cinco-iconos,
    div[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        max-height: none !important;
    }

    /* Modales centrados y con scroll si se requiere */
    #modal-conos-armado > div,
    #modal-pago-mixto > div {
        max-width: 95vw !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        padding: 20px !important;
    }
}

/* 2. CELULARES Y PANTALLAS PEQUEÑAS (hasta 768px) */
@media (max-width: 768px) {
    html, body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 8px !important;
    }

    /* POS pasa de horizontal rígido a columna fluida vertical */
    .pos-maestro-layout {
        flex-direction: column !important;
        height: auto !important;
        gap: 16px !important;
    }

    .seccion-izquierda-menu {
        width: 100% !important;
        order: 1;
    }

    .columna-factura-derecha {
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        order: 2;
        margin-top: 10px !important;
        border-radius: 16px !important;
        padding: 14px !important;
    }

    /* Pestañas de navegación con scroll táctil horizontal */
    .nav-tabs-pos,
    .seccion-izquierda-menu > div:first-of-type {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding-bottom: 6px !important;
    }

    .nav-tabs-pos button,
    .seccion-izquierda-menu > div:first-of-type button {
        flex: 0 0 auto !important;
        min-width: 130px !important;
        height: 48px !important;
        font-size: 12px !important;
        padding: 0 10px !important;
    }

    /* Grillas de productos en 2 columnas en celular */
    #section-principales,
    #section-postres,
    .cuadricula-cinco-iconos,
    div[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    .tarjeta-plato-tactil {
        min-height: 110px !important;
        padding: 12px 8px !important;
    }

    .texto-plato-nombre {
        font-size: 12px !important;
    }

    .texto-plato-precio {
        font-size: 15px !important;
    }

    /* Barra inferior de tasa y salir */
    div[style*="background: rgba(14, 34, 84, 0.85);"][style*="border-radius: 12px;"] {
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between !important;
        margin-top: 12px !important;
    }

    /* Modales flotantes para celular */
    #modal-conos-armado > div,
    #modal-pago-mixto > div,
    #modal-submenus > div {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 92vh !important;
        overflow-y: auto !important;
        padding: 16px !important;
    }

    #modal-conos-armado div[style*="display: flex; gap: 30px;"],
    #modal-pago-mixto div[style*="display: flex; gap: 30px;"] {
        flex-direction: column !important;
        gap: 16px !important;
    }

    #modal-conos-armado div[style*="border-left: 2px solid"] {
        border-left: none !important;
        border-top: 2px solid #334155 !important;
        padding-left: 0 !important;
        padding-top: 16px !important;
    }

    #grid-salsas-cono {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Carrito altura en móvil */
    #carrito-items {
        max-height: 220px !important;
    }

    /* Admin Panel Adaptabilidad */
    .admin-container {
        padding: 1rem !important;
    }

    .navbar {
        padding: 0.8rem 1rem !important;
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .card-metric {
        padding: 1rem !important;
    }

    .metric-value {
        font-size: 1.4rem !important;
    }

    .dashboard-layout {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Login e Identificar */
    .login-card, .identificar-card {
        padding: 1.8rem 1.2rem !important;
        border-radius: 18px !important;
        max-width: 100% !important;
    }

    .brand-title {
        font-size: 1.6rem !important;
    }
}

/* 3. CELULARES MUY ESTRECHOS (hasta 420px) */
@media (max-width: 420px) {
    .metrics-grid {
        grid-template-columns: 1fr !important;
    }

    #section-principales,
    .cuadricula-cinco-iconos {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .grid-pagos-tres-columnas {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==========================================================================
   📦 CAJA SCROLLEABLE PARA TABLA DE INVENTARIO
   ========================================================================== */
.table-scroll-box {
    overflow-y: auto !important;
    overflow-x: auto !important;
    max-height: 440px !important;
    border-radius: 14px !important;
    border: 1.5px solid #1a3c7d !important;
    background: rgba(6, 17, 41, 0.65) !important;
    scrollbar-width: thin !important;
    scrollbar-color: #FFB800 rgba(7, 22, 56, 0.8) !important;
}

.table-scroll-box::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.table-scroll-box::-webkit-scrollbar-track {
    background: rgba(7, 22, 56, 0.8);
    border-radius: 4px;
}
.table-scroll-box::-webkit-scrollbar-thumb {
    background: #FFB800;
    border-radius: 4px;
}
.table-scroll-box::-webkit-scrollbar-thumb:hover {
    background: #FFA000;
}

.table-scroll-box thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background-color: #06132e !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* ==========================================================================
   🍟 ANIMACIÓN DE CARGA CORPORATIVA SR. PAPA CON LOGO
   ========================================================================== */
.srpapa-loader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 14, 36, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 999999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    animation: srpapaFadeIn 0.25s ease-out;
}

@keyframes srpapaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.srpapa-loader-box {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.srpapa-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3.5px solid rgba(255, 184, 0, 0.15);
    border-top: 3.5px solid #FFB800;
    border-right: 3.5px solid #10B981;
    animation: srpapaSpin 1.1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    box-shadow: 0 0 25px rgba(255, 184, 0, 0.25);
}

@keyframes srpapaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.srpapa-logo-pulse {
    width: 82px;
    height: 82px;
    object-fit: contain;
    filter: drop-shadow(0 4px 15px rgba(255, 184, 0, 0.45));
    animation: srpapaPulse 1.4s ease-in-out infinite;
    z-index: 2;
}

@keyframes srpapaPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 4px 14px rgba(255, 184, 0, 0.35)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 6px 22px rgba(255, 184, 0, 0.6)); }
}

.srpapa-loader-text {
    font-size: 1.05rem;
    font-weight: 900;
    color: #FFB800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(255, 184, 0, 0.35);
    text-align: center;
}

.srpapa-loader-sub {
    font-size: 0.8rem;
    font-weight: 700;
    color: #9BB0D3;
    letter-spacing: 0.5px;
    margin: 0;
    text-align: center;
}
