/**
 * AEP AURORA PREMIUM VISUAL CORE (S-073)
 * Unified Master Stylesheet
 * 100% Hermoso, 0% Nombres Técnicos, Glassmorphism + Dark Obsidian
 */

:root {
    /* Mágicolores Aurora */
    --obsidian: #080810;
    --surface: #12121E;
    --s-surface: rgba(255, 255, 255, 0.03);
    --gold: #D4AF37;
    --s-gold: #E5C354;
    --white: #F0F0F0;
    --s-txt: rgba(240, 240, 240, 0.6);
    --aep-err: #E74C3C;
    --aep-ok: #2ECC71;
    --bezier: cubic-bezier(0.25, 1, 0.5, 1);
}

body {
    margin: 0; padding: 0;
    background-color: var(--obsidian);
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, .swiss-title, .kpi-h {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- THE AURORA BACKGROUND MAGIC --- */
.aurora-bg {
    position: fixed; inset: 0; z-index: -2;
    background: radial-gradient(circle at 10% 20%, rgba(212,175,55,0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(135,206,235,0.03) 0%, transparent 40%);
}
.aurora-blob-3 {
    position: fixed; width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(212,175,55,0.04) 0%, transparent 70%);
    top: -20%; right: -10%; z-index: -1;
    animation: drift 20s infinite alternate var(--bezier);
}
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(-50px, 50px) scale(1.1); } }

/* --- PREMIUM MODULES (GLASSMORPHISM) --- */
.swiss-module, .glass-card {
    background: rgba(18, 18, 30, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transition: all 0.4s var(--bezier);
}
.swiss-module:hover, .glass-card:hover {
    border-color: rgba(212,175,55,0.15);
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
}

/* --- BTN-AEP · Aurora Glass S-090 · unificado --- */
.btn-aep, .btn-sync {
    background: rgba(212,175,55,0.07);
    color: var(--gold);
    border: 1px solid rgba(212,175,55,0.32);
    padding: 10px 18px;
    border-radius: 5px;
    font-family: 'DM Mono', monospace; font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    text-transform: uppercase; font-size: 10px; letter-spacing: 1.5px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    position: relative; overflow: hidden;
    backdrop-filter: blur(8px);
}
/* glass sweep — light shimmer on hover */
.btn-aep::before, .btn-sync::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.07) 50%, transparent 100%);
    transform: translateX(-110%);
    transition: transform 0.45s ease;
    pointer-events: none;
}
.btn-aep:hover, .btn-sync:hover {
    background: rgba(212,175,55,0.14);
    border-color: rgba(212,175,55,0.6);
    box-shadow: 0 0 18px rgba(212,175,55,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    transform: translateY(-1px);
}
.btn-aep:hover::before, .btn-sync:hover::before { transform: translateX(110%); }
.btn-aep:active, .btn-sync:active {
    transform: translateY(0) scale(0.97);
    background: rgba(212,175,55,0.2);
    box-shadow: 0 0 8px rgba(212,175,55,0.25);
}
.btn-aep.active, .btn-sync.active {
    background: rgba(212,175,55,0.18);
    border-color: rgba(212,175,55,0.7);
    box-shadow: 0 0 14px rgba(212,175,55,0.2);
    color: #fff;
}

.btn-del {
    background: rgba(231, 76, 60, 0.1); color: var(--aep-err); border: 1px solid rgba(231, 76, 60, 0.3); 
    padding: 14px 24px; border-radius: 25px; font-family: 'Syne', sans-serif; font-weight: 700; cursor: pointer; transition: 0.3s;
    font-size: 11px; letter-spacing: 1px;
}
.btn-del:hover { background: var(--aep-err); color: white; transform: scale(1.02); box-shadow: 0 8px 20px rgba(231,76,60,0.3); }

/* --- INPUTS & FORMS --- */
input, select, .inp-aep {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255,255,255,0.1);
    color: var(--white); padding: 16px; border-radius: 14px;
    font-family: 'DM Mono', monospace; outline: none; transition: 0.3s;
    width: 100%; box-sizing: border-box;
}
input:focus, select:focus, .inp-aep:focus {
    border-color: var(--gold); background: rgba(212,175,55,0.05);
    box-shadow: 0 0 15px rgba(212,175,55,0.1);
}

/* --- TABS (CEO) --- */
.tabs { display: flex; gap: 10px; padding: 20px 40px; background: rgba(0,0,0,0.2); overflow-x: auto; border-bottom: 1px solid rgba(255,255,255,0.05); }
.tab { 
    padding: 8px 16px; border-radius: 20px; font-size: 11px; 
    font-weight: 700; cursor: pointer; opacity: 0.5; transition: all 0.3s var(--bezier); 
    display: flex; align-items: center; gap: 6px;
    text-decoration: none; color: var(--white);
}
.tab:hover { opacity: 0.8; background: rgba(212,175,55,0.1); transform: translateY(-2px); }
.tab.on { 
    opacity: 1; background: rgba(212,175,55,0.1); color: var(--gold) !important;
    border: 1px solid rgba(212,175,55,0.4);
    box-shadow: 0 0 15px rgba(212,175,55,0.15), inset 0 0 10px rgba(212,175,55,0.05);
    transform: translateY(-1px);
}

/* Modifier: Venta Ferias Green Tab */
.tab-venta.on {
    background: rgba(46, 204, 113, 0.12) !important;
    border-color: rgba(46, 204, 113, 0.5) !important;
    color: #2ECC71 !important;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.15);
}
.tab-venta i { color: #2ECC71; }
.tab-venta.on i, .tab-venta.on span { color: #2ECC71 !important; }

/* --- GRID SYSTEM --- */
.grid-erp { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; padding: 20px 40px; }
.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-8 { grid-column: span 8; }
@media (max-width: 900px) {
    .col-6, .col-4, .col-3, .col-8 { grid-column: span 12; }
    .grid-erp, .tabs { padding: 15px; }
}

/* --- TABLES --- */
.tcard { overflow-x: auto; background: var(--surface); border-radius: 15px; border: 1px solid rgba(255,255,255,0.05); }
.t-master { width: 100%; border-collapse: collapse; font-size: 12px; }
.t-master th { background: rgba(0,0,0,0.3); color: var(--gold); padding: 15px; text-align: left; font-family: 'Syne', sans-serif; font-size:10px; letter-spacing:1px; }
.t-master td { padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.t-master tr:hover { background: rgba(255,255,255,0.02); }

/* --- HEADER --- */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 20px 40px; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,0.05); }
.hdr-t { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; }
.hdr-av { width: 40px; height: 40px; border-radius: 50px; border: 2px solid var(--gold); object-fit: cover; }

/* --- MODALS --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(15px); z-index: 1000; display: none; align-items: center; justify-content: center; opacity:0; animation: fadeInModal 0.3s forwards; }
.modal-aep-open { display: flex !important; opacity: 1 !important; animation: none !important; }
.modal-content { background: var(--obsidian); border: 1px solid rgba(212,175,55,0.2); border-radius: 24px; padding: 30px; width: 90%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); transform: scale(0.95); animation: popModal 0.4s var(--bezier) forwards; }
@keyframes popModal { to { transform: scale(1); opacity: 1; } }
@keyframes fadeInModal { to { opacity: 1; } }

/* --- MAC NOTIFICATIONS --- */
.toast-mac { background: rgba(255,255,255,0.9); color: #000; padding: 15px 20px; border-radius: 12px; font-size: 13px; display: flex; align-items: center; gap: 15px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); animation: slideInMac 0.5s var(--bezier) forwards; margin-bottom: 10px; width: 300px; pointer-events: none; }
.toast-mac b { font-weight: 800; display: block; font-size: 14px; margin-bottom: 2px; }
.toast-mac span { opacity: 0.7; }
.toast-mac.warning { border-left: 5px solid #F39C12; }
.toast-mac.error { border-left: 5px solid #E74C3C; }
@keyframes slideInMac { from { transform: translateX(120%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes slideOutMac { to { transform: translateX(120%); opacity:0; } }
#centinela-toasts { position: fixed; top: 20px; right: 20px; z-index: 9999; }

/* Kpi Labels */
.kpi-label { font-size: 10px; color: var(--gold); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; opacity: 0.8; font-weight: 700; }

/* ================================================================
   MOBILE AURORA COMPONENTS (S-073)
   Variables de compatibilidad y componentes del POS
   ================================================================ */

:root {
    /* Aliases para compatibilidad con el JS legado */
    --p-border: rgba(255,255,255,0.08);
    --p-black:  #080810;
    --s-bg:     var(--obsidian);
    --s-txt:    var(--white);
    --r-md:     15px;
    --r-lg:     20px;
}

/* VIEW SYSTEM */
.view { display: none; min-height: 100vh; flex-direction: column; animation: fadeInView 0.3s ease-out; }
.view.active { display: flex; }
@keyframes fadeInView { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.main-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* PRODUCT CARDS (POS) */
.prod-card {
    background: rgba(18,18,30,0.6);
    border: 1px solid var(--p-border);
    padding: 18px; border-radius: 16px;
    text-align: center; cursor: pointer;
    transition: all 0.25s var(--bezier);
    display: flex; flex-direction: column; align-items: center;
    backdrop-filter: blur(10px);
}
.prod-card:hover { border-color: rgba(212,175,55,0.3); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.prod-card:active { transform: scale(0.95); background: rgba(212,175,55,0.08); }

/* AVATAR GRID */
.av-opt { width: 60px; height: 60px; border-radius: 50%; border: 2px solid transparent; object-fit: cover; opacity: 0.6; transition: 0.2s; cursor: pointer; }
.av-opt.on, .av-opt:focus { border-color: var(--gold); opacity: 1; transform: scale(1.05); outline: none; }

/* MOBILE TOAST */
#toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    background: var(--gold); color: var(--obsidian);
    padding: 12px 28px; border-radius: 30px;
    font-size: 13px; font-weight: 800; font-family: 'Syne', sans-serif;
    z-index: 5000; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}
#toast.show { opacity: 1; }

/* LOCKOUT BARRIER (Anti-Fraude S-097) */
#lockout-barrier {
    position: fixed; inset: 0;
    background: rgba(8,8,16,0.97);
    backdrop-filter: blur(20px);
    z-index: 9000; display: none;
    flex-direction: column; align-items: center; justify-content: center;
    color: var(--gold); font-family: 'Syne', sans-serif;
}
#lockout-timer {
    font-size: 80px; font-weight: 800;
    transition: transform 0.2s var(--bezier);
    text-shadow: 0 0 30px rgba(212,175,55,0.5);
}

/* QR READER MODAL (Mobile) */
#reader-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.95); z-index: 8000;
    flex-direction: column;
}

/* PASSWORD EYE WRAPPER */
.inp-eye-wrap { position: relative; width: 100%; margin-bottom: 20px; }
.inp-eye-wrap input { margin-bottom: 0; padding-right: 50px; }
.inp-eye-btn {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--gold); opacity: 0.6; transition: opacity 0.2s;
    display: flex; align-items: center; padding: 0;
}
.inp-eye-btn:hover { opacity: 1; }

/* READER MODAL QTY / PAGO BUTTONS */
.qty-btn, .pago-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--p-border);
    color: var(--white); padding: 10px 16px; border-radius: 20px;
    font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 700;
    cursor: pointer; transition: 0.25s;
}
.qty-btn.active, .pago-btn.active {
    background: var(--gold); color: var(--obsidian); border-color: var(--gold);
}

/* SCROLL HIDDEN BARS */
* { scrollbar-width: thin; scrollbar-color: rgba(212,175,55,0.2) transparent; }

/* --- VARIANTES AURORA COLOR (S-073) --- */
.btn-aurora-ok {
    background: rgba(46,204,113,0.08) !important;
    color: #2ECC71 !important;
    border: 1px solid rgba(46,204,113,0.4) !important;
}
.btn-aurora-warn {
    background: rgba(241,196,15,0.08) !important;
    color: #F1C40F !important;
    border: 1px solid rgba(241,196,15,0.4) !important;
}
.btn-aurora-err {
    background: rgba(231,76,60,0.08) !important;
    color: #E74C3C !important;
    border: 1px solid rgba(231,76,60,0.4) !important;
}
.aep-chip {
    font-size: 8px; padding: 3px 8px;
    background: rgba(212,175,55,0.1);
    color: var(--gold);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 6px;
    display: inline-block;
    font-weight: 800;
}

/* --- BTN-CHAT-ONYX · Botón send del panel lateral S-090 --- */
.btn-chat-onyx {
    width: 36px; height: 36px; flex-shrink: 0;
    background: rgba(212,175,55,0.08);
    border: 1px solid rgba(212,175,55,0.35);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative; overflow: hidden;
}
.btn-chat-onyx::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}
.btn-chat-onyx:hover {
    background: rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.6);
    box-shadow: 0 0 14px rgba(212,175,55,0.2);
}
.btn-chat-onyx:hover::before { transform: translateX(100%); }
.btn-chat-onyx:active { transform: scale(0.94); }

/* --- @keyframes S-090 (BUG FIX: cardIn + skeletonPulse ausentes) --- */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
@keyframes skeletonPulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 0.08; }
}

/* ANIMACIONES AURORA (S-073) */
@keyframes logo-pulse {
    0% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 20px rgba(212,175,55,0.2); }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 50px rgba(212,175,55,0.4); }
    100% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 20px rgba(212,175,55,0.2); }
}

.logo-pulse {
    animation: logo-pulse 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-entry {
    animation: slide-up 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

/* KPI Cards fondo blanco — LEA Senior S-091 */
.kpi-card-light {
    background: #FFFFFF;
    border: 1px solid rgba(212,175,55,0.25);
    border-left: 4px solid #D4AF37;
    backdrop-filter: none;
}
.kpi-card-light:hover {
    box-shadow: 0 12px 40px rgba(212,175,55,0.15);
    transform: translateY(-2px);
}
.kpi-card-light .kpi-label { color: #555; }
.kpi-card-light .kpi-val   { color: #080810; }
.kpi-card-light .kpi-sub   { color: #666; font-size:10px; margin-top:4px; }

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