/* style.css - Estilos Globales Completos Actualizados */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colores Principales */
    --primary: #3C50E0;
    --primary-hover: #4F61E3;
    
    /* Fondos Modo Claro */
    --bg-body: #F1F5F9;
    --bg-panel: #FFFFFF;
    --bg-header: #FFFFFF;
    --bg-sidebar: #1C2434;
    
    /* Textos Modo Claro */
    --text-main: #1C2434;
    --text-body: #64748B;
    --text-light: #DEE4EE;
    
    /* Bordes y UI */
    --border-color: #E2E8F0;
    --input-bg: #FFFFFF;
    --input-border: #E2E8F0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    
    /* Dimensiones Fijas */
    --sidebar-width: 280px;
    --header-height: 80px; 
    --transition-speed: 0.3s;
}

/* --- MODO OSCURO --- */
body.dark-mode {
    --bg-body: #1A222C;
    --bg-panel: #24303F;
    --bg-header: #24303F;
    --bg-sidebar: #24303F; 
    --text-main: #FFFFFF;
    --text-body: #AEB7C0;
    --border-color: #2E3A47;
    --input-bg: #1D2A39;
    --input-border: #3D4D60;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* --- RESET Y BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { 
    background-color: var(--bg-body); 
    color: var(--text-body); 
    transition: background-color var(--transition-speed), color var(--transition-speed); 
    overflow-x: hidden; 
}
a { text-decoration: none; }
ul { list-style: none; }

/* --- LAYOUT PRINCIPAL --- */
.wrapper { display: flex; height: 100vh; overflow: hidden; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; position: relative; }

/* --- SIDEBAR (BARRA LATERAL) --- */
.sidebar { 
    width: var(--sidebar-width); 
    background-color: var(--bg-sidebar); 
    color: var(--text-light); 
    display: flex; 
    flex-direction: column; 
    transition: width var(--transition-speed); 
    z-index: 999; 
    
    /* Scroll oculto pero funcional */
    overflow-y: auto; 
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.sidebar::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.sidebar-header { padding: 2rem; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-text { font-size: 1.5rem; font-weight: 700; color: #fff; white-space: nowrap; }
.logo-icon { background: var(--primary); padding: 5px; border-radius: 5px; color: white; min-width: 32px; display: flex; justify-content: center; align-items: center; }

.sidebar-menu { padding: 1rem 2rem 4rem; }
.menu-group-title { font-size: 0.85rem; text-transform: uppercase; color: #8A99AF; margin-bottom: 1rem; margin-top: 1.5rem; font-weight: 600; }
.menu-item { margin-bottom: 0.5rem; }

/* Estilos de Enlaces del Menú */
.menu-link { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px 15px; 
    color: var(--text-light); 
    border-radius: 5px; 
    transition: 0.2s; 
    font-size: 1rem; 
    white-space: nowrap; 
    position: relative;
}
.menu-link:hover, .menu-link.active, .menu-link.active-parent { 
    background-color: #333A48; 
    color: #fff; 
}

/* --- ESTILOS ACORDEÓN --- */
.menu-link.has-submenu {
    justify-content: space-between; 
    cursor: pointer;
}

.arrow-icon {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.menu-link.active-parent .arrow-icon {
    transform: rotate(180deg);
}

.submenu {
    display: none; 
    list-style: none;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.15); 
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.submenu.open {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.submenu .menu-link {
    padding-left: 45px; 
    font-size: 0.9rem;
    color: #8A99AF; 
}
.submenu .menu-link:hover, .submenu .menu-link.active {
    color: #fff;
    background-color: transparent; 
}
.submenu .menu-link.active {
    color: var(--primary); 
    font-weight: 600;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- HEADER (BARRA SUPERIOR) --- */
.header { 
    background-color: var(--bg-header); 
    height: var(--header-height); 
    min-height: var(--header-height); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 2rem; 
    box-shadow: var(--shadow); 
    position: sticky; 
    top: 0; 
    z-index: 99;
    flex-shrink: 0; 
}

.header-left, .header-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.header-center {
    display: none; 
    flex-grow: 1; 
    justify-content: center; 
    align-items: center; 
    padding: 0 20px; 
    height: 100%;
}

/* Botones del Header */
.icon-btn, .toggle-btn { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    color: var(--text-body); 
    font-size: 1.2rem; 
    padding: 8px; 
    border-radius: 50%; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 40px; 
    height: 40px;
}
.icon-btn:hover, .toggle-btn:hover { background-color: var(--bg-body); color: var(--primary); }

/* --- COMPONENTES GLOBALES --- */
.page-content { padding: 1rem 2rem 2rem 2rem; } 
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 1.5rem; }

.card { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 5px; box-shadow: var(--shadow); overflow: hidden; }
.card-header { background-color: var(--bg-body); border-bottom: 1px solid var(--border-color); padding: 1rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 10px; }

/* Tablas Estilizadas */
.table-responsive { overflow-x: auto; }
.styled-table { width: 100%; border-collapse: collapse; text-align: center; }
.styled-table th, .styled-table td { padding: 12px; border: 1px solid var(--border-color); color: var(--text-main); }
.styled-table th { background-color: var(--bg-body); color: var(--text-body); font-weight: 600; font-size: 0.9rem; }
.styled-table td { font-weight: 500; font-size: 0.95rem; }

/* =========================================
   --- ESTILOS DE NOTIFICACIONES (POPUP) ---
   ========================================= */

.notification-container {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background-color: #EF4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-header);
    z-index: 10;
}

/* El Contenedor Flotante (La tarjeta blanca) */
.notification-popover {
    position: absolute;
    top: 55px;
    right: -10px;
    width: 320px;
    background-color: var(--bg-panel); /* Fondo blanco/oscuro */
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Bordes más redondeados */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    visibility: hidden;
}

.notification-popover.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Cabecera del Popup */
.notification-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-main);
    background-color: var(--bg-body);
    font-size: 0.95rem;
}

.notification-popover-header i {
    cursor: pointer;
    color: var(--text-body);
}
.notification-popover-header i:hover { color: #EF4444; }

/* Lista de mensajes */
.notification-list {
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

/* Cada item individual */
.notification-item {
    display: flex;
    align-items: start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 12px;
}

.notification-item:hover {
    background-color: var(--bg-body);
}

.notification-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-color);
}

.notification-content {
    flex: 1;
    overflow: hidden;
}

.notification-title {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.notification-preview {
    display: block;
    font-size: 0.75rem;
    color: var(--text-body);
    line-height: 1.3;
    margin-bottom: 4px;
    /* Truncar texto largo */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-meta {
    font-size: 0.65rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

/* Footer del Popup */
.notification-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-panel);
    text-align: center;
}

.notification-footer button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.notification-footer button:hover {
    background-color: var(--primary-hover);
}