/* /assets/css/principal.css - Ecosistema Integralis Layout */

/* ==========================================================================
   1. VARIABLES DE LAYOUT Y DIMENSIONES
   ========================================================================== */
:root {
    --header-height: 60px;
    --footer-height: 60px;
}

/* ==========================================================================
   2. CONTENEDORES Y ESPACIADOS DE CAPAS (Capa 1 vs Capa 2)
   ========================================================================== */
#main-dashboard-view {
    padding-top: calc(var(--header-height) + 15px);
    padding-bottom: calc(var(--footer-height) + 15px);
    padding-left: 15px;
    padding-right: 15px;
    min-height: 100vh;
    box-sizing: border-box;
}

#spa-module-view {
    padding-top: calc(var(--header-height) + 15px);
    padding-left: 15px;
    padding-right: 15px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Ajuste de espaciado dinámico según la capa activa */
body.capa-1-activa #spa-module-view {
    padding-bottom: calc(var(--footer-height) + 15px);
}

body.capa-2-activa #spa-module-view {
    padding-bottom: 25px;
}

/* ==========================================================================
   3. CABECERA GLOBAL (TOPBAR)
   ========================================================================== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.topbar-left { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

.topbar-right { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

/* Elementos del Usuario */
.avatar-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.avatar-circle {
    width: 40px; 
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--integralis, #885ccd);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.avatar-circle:hover {
    transform: scale(1.04);
}

.user-greeting { 
    font-weight: 600; 
    font-size: 0.95rem; 
    color: var(--text-main, #000000);
}

[data-theme="dark"] .user-greeting {
    color: #ffffff !important;
}

/* Ícono SVG de Notificaciones */
.topbar-notification-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.topbar-notification-icon svg,
.topbar-notification-icon svg path {
    fill: var(--text-muted) !important;
    transition: fill 0.2s ease;
}

[data-theme="dark"] .topbar-notification-icon svg,
[data-theme="dark"] .topbar-notification-icon svg path {
    fill: #ffffff !important;
}

/* Botón de Retroceso (Capa 2) */
.btn-back {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-back svg {
    fill: var(--text-main);
    transition: fill 0.2s ease;
}

.btn-back:hover {
    background-color: var(--bg-main);
    color: var(--integralis, #885ccd);
    border-color: var(--integralis, #885ccd);
}

.btn-back:hover svg {
    fill: var(--integralis, #885ccd);
}

/* Botón Menú 3 Puntos (Capa 2) */
.dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-icon-more {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.15rem;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.btn-icon-more:hover {
    background: var(--bg-main);
    color: var(--integralis, #885ccd);
}

/* ==========================================================================
   4. DROPDOWNS BASE Y DIFERENCIACIÓN DE ALINEACIÓN
   ========================================================================== */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: none;
    flex-direction: column;
    padding: 6px 0;
    overflow: hidden;
}

/* Alineación IZQUIERDA (Para Avatar en topbar-left) */
.dropdown-menu-left {
    left: 0;
    right: auto;
}

/* Alineación DERECHA (Para Menú de 3 Puntos en topbar-right) */
.dropdown-menu-right {
    right: 0;
    left: auto;
}

/* Activación por JavaScript */
.dropdown-menu.show {
    display: flex !important;
    animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ítems del Dropdown */
.dropdown-menu a,
.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-menu a:hover,
.dropdown-menu .dropdown-item:hover {
    background: var(--bg-main);
    color: var(--integralis, #885ccd);
}

.dropdown-icon {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.dropdown-menu a:hover .dropdown-icon {
    color: var(--integralis, #885ccd);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

/* Opción para Cambio de Tema */
.theme-toggle-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.theme-text-container {
    display: inline-flex;
    align-items: center;
}

/* Enlace de Cierre de Sesión */
.dropdown-menu a.logout-link {
    color: #ef4444;
}

.dropdown-menu a.logout-link .dropdown-icon {
    color: #ef4444;
}

.dropdown-menu a.logout-link:hover {
    background-color: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

/* ==========================================================================
   5. BARRA DE NAVEGACIÓN INFERIOR (BOTTOM NAV)
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--footer-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item.active { 
    color: var(--integralis, #885ccd) !important; 
    font-weight: 700; 
}

.nav-item svg { 
    width: 22px; 
    height: 22px; 
    margin-bottom: 2px; 
    fill: currentColor; 
}