/* ==========================================================================
   CASINO VIP THEME - LAYOUT SYSTEM (VERSION FINAL CORREGIDA)
   ========================================================================== */

/* --- 1. VARIABLES & CONFIGURACIÓN --- */
:root {
    --bg-body: #050505;           /* Negro Profundo */
    --bg-panel: #0a0a0a;          /* Negro Panel */
    --bg-glass: rgba(15, 15, 15, 0.95); /* Vidrio Ahumado */
    
    /* Gradientes Dorados (Efecto Oro Real) */
    --gold-primary: #d4af37;
    --gold-gradient: linear-gradient(135deg, #bf953f 0%, #fcf6ba 45%, #b38728 70%, #fbf5b7 100%);
    --gold-subtle: rgba(212, 175, 55, 0.15);
    
    /* Estados */
    --green-neon: #2ecc71;
    --red-alert: #e74c3c;
    
    /* Dimensiones */
    --header-height: 70px;
    --sidebar-width: 280px;
}

/* Reset Básico */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-body);
    font-family: 'Poppins', sans-serif;
    color: #fff;
    overflow-x: hidden;
}

/* ==========================================================================
   2. GLOBAL HEADER (TOPBAR)
   ========================================================================== */
#global-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    transition: all 0.3s ease;
    background: #000; /* Asegura fondo negro siempre */
}

/* --- ESTILOS PARA LA BARRA DE INVITADO (.navbar.guest-mode) --- */
.navbar.guest-mode {
    background: rgba(0, 0, 0, 0.98) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 30px rgba(0,0,0,0.8);
    padding: 0 15px !important;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

/* Contenedor Flex Principal */
.navbar.guest-mode .nav-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Animado */
.navbar.guest-mode .logo img {
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.3));
}

.navbar.guest-mode .logo:hover img {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.6));
}

/* Botones Generales */
.nav-btn {
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.5px;
    transition: all 0.3s ease !important;
    white-space: nowrap; /* Evita que el texto se rompa */
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,255,255,0.1);
}

.nav-btn.cta-btn {
    background: var(--gold-gradient) !important;
    color: #000 !important;
    border: none !important;
    position: relative;
    overflow: hidden;
}

.nav-btn.cta-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    transition: 0.5s;
}
.nav-btn.cta-btn:hover::after { left: 100%; }


/* --- ESTILOS PARA LA BARRA DE LOGUEADO (.top-bar.logged-in) --- */
.top-bar.logged-in {
    background: #000 !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    height: var(--header-height);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.icon-btn {
    transition: color 0.3s, transform 0.2s;
}
.icon-btn:hover {
    color: var(--gold-primary) !important;
    transform: scale(1.1);
}

/* ==========================================================================
   3. SIDEBAR (BARRA LATERAL)
   ========================================================================== */
#global-sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-width);
    background: #000 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Avatar del Usuario */
.side-avatar {
    border: 2px solid var(--gold-primary) !important;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2) !important;
    position: relative;
}
.side-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px; right: 2px;
    width: 12px; height: 12px;
    background: #2ecc71;
    border: 2px solid #000;
    border-radius: 50%;
}

/* Enlaces del Menú */
.nav-link {
    border-radius: 8px;
    margin: 5px 12px !important;
    border-left: 3px solid transparent !important;
    transition: all 0.3s ease !important;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    padding-left: 25px !important;
    color: #fff !important;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.15) 0%, transparent 100%) !important;
    border-left-color: var(--gold-primary) !important;
    color: #fff !important;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.nav-link i {
    transition: transform 0.3s;
}
.nav-link:hover i {
    transform: scale(1.2) rotate(5deg);
    color: var(--gold-primary);
}

/* ==========================================================================
   4. RESPONSIVE LOGIC (CORREGIDO)
   ========================================================================== */

/* 💻 MODO ESCRITORIO (Pantallas grandes) */
@media (min-width: 769px) {
    /* 1. Header visible, pero ocultamos botón Sidebar */
    #global-header {
        display: block !important;
    }
    
    .mobile-only {
        display: none !important; /* Oculta botón hamburguesa */
    }

    /* 2. Sidebar ajustado DEBAJO del header */
    #global-sidebar:not([hidden]) { 
        top: var(--header-height) !important;
        height: calc(100vh - var(--header-height)) !important;
        transform: translateX(0) !important;
        z-index: 998;
    }

    /* 3. Contenido Principal empujado */
    .main-content, .main-panel {
        margin-left: var(--sidebar-width) !important;
        margin-top: var(--header-height) !important; /* Baja el contenido */
        padding: 30px;
    }

    /* Ajuste para modo invitado en escritorio */
    body:has(.guest-mode) .main-content {
        margin-left: 0 !important;
    }
}

/* 📱 MODO MÓVIL (Celulares) */
@media (max-width: 768px) {
    
    #global-header { display: block !important; }

    /* Sidebar oculto por defecto */
    #global-sidebar {
        top: var(--header-height) !important;
        height: calc(100vh - var(--header-height)) !important;
        transform: translateX(-100%);
        width: 100% !important;
        max-width: 300px;
        box-shadow: 5px 0 20px rgba(0,0,0,0.8);
    }

    #global-sidebar.active {
        transform: translateX(0);
    }

    .main-content, .main-panel {
        margin-left: 0 !important;
        margin-top: var(--header-height) !important;
        padding: 15px;
    }

    /* --- TRUCO VIP: ALINEACIÓN INVITADO MÓVIL --- */
    /* Rompemos el contenedor para ordenar los elementos libremente */
    .navbar.guest-mode .nav-container {
        display: flex;
        flex-direction: row !important;
        justify-content: space-between !important;
        width: 100%;
        padding: 0 5px;
    }

    /* Usamos 'contents' para que los botones sean hijos directos del flex container */
    .navbar.guest-mode .nav-buttons {
        display: contents !important;
    }

    /* ORDEN VITAL: [Resultados] [Logo] [Ingresar] */
    
    /* 1. Botón Resultados (Izquierda) */
    .navbar.guest-mode .nav-btn[href*="resultados"] {
        order: 1;
        font-size: 0.7rem !important;
        padding: 6px 10px !important;
    }

    /* 2. Logo con Texto a los lados (Solo Móvil) */
    .navbar.guest-mode .logo {
        order: 2;
        margin: 0 auto;
        transform: scale(0.9);
        display: flex !important;
        align-items: center;
        gap: 5px;
    }
    
    /* Ocultamos el bloque de texto original para sustituirlo */
    .navbar.guest-mode .logo div {
        display: none !important; 
    }

    /* Pseudo-elementos para el texto lateral */
    .navbar.guest-mode .logo::before {
        content: 'Animalitos';
        color: #fff;
        font-size: 0.7rem;
        font-weight: 800;
        text-transform: uppercase;
    }
    
    .navbar.guest-mode .logo::after {
        content: 'Venezuela';
        color: var(--gold-primary);
        font-size: 0.7rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    /* 3. Botón Ingresar (Derecha) */
    .navbar.guest-mode .nav-btn.cta-btn {
        order: 3;
        font-size: 0.7rem !important;
        padding: 6px 12px !important;
    }
}

/* ==========================================================================
   5. NOTIFICACIONES (TOASTS) VIP
   ========================================================================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(12px);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--gold-primary);
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: toastSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: pointer;
}

.toast.removing {
    animation: toastFadeOut 0.4s ease forwards;
}

.toast.success { border-left-color: var(--green-neon); }
.toast.success i { color: var(--green-neon); text-shadow: 0 0 10px rgba(46, 204, 113, 0.4); }

.toast.error { border-left-color: var(--red-alert); }
.toast.error i { color: var(--red-alert); text-shadow: 0 0 10px rgba(231, 76, 60, 0.4); }

.toast.warning { border-left-color: var(--gold-primary); }
.toast.warning i { color: var(--gold-primary); text-shadow: 0 0 10px rgba(241, 196, 15, 0.4); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastFadeOut {
    to { opacity: 0; transform: translateX(50%) scale(0.9); }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-primary); }