:root {
    --primary: #4285F4;
    --primary-dark: #2e59d9;
    --sidebar-w: 250px;
    --sidebar-c: 75px;
    --bg-light: #f8f9fc;
    --border-color: #e3e6f0;
}

/* --- RESET Y BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Nunito', sans-serif; 
    background: var(--bg-light); 
    display: flex; 
    min-height: 100vh;
}

/* --- SIDEBAR --- */
#sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--primary);
    position: fixed;
    left: 0; top: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: visible; 
}

#sidebar.collapsed { width: var(--sidebar-c); }

.sidebar-brand {
    height: 70px;
    display: flex; align-items: center; padding: 0 20px;
    background: rgba(0,0,0,0.1); color: white; text-decoration: none;
    font-weight: 800; font-size: 1rem; gap: 12px;
}

/* NAVEGACIÓN */
.nav-group { position: relative; width: 100%; }

.nav-link {
    display: flex; align-items: center; padding: 15px 20px;
    color: rgba(255,255,255,0.8); text-decoration: none; cursor: pointer;
    white-space: nowrap; transition: 0.2s; font-weight: 600;
}
.nav-link i { min-width: 35px; font-size: 1.1rem; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }

/* SUBMENÚS */
.submenu {
    display: none;
    background: white;
    margin: 0 15px 10px 15px;
    border-radius: 8px;
    list-style: none;
    padding: 10px 0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.15);
}
.submenu a {
    padding: 8px 20px 8px 40px;
    display: block; color: #3a3b45; text-decoration: none; 
    font-size: 0.85rem; line-height: 2;
}
.submenu a:hover { color: var(--primary); font-weight: 700; background: #f8f9fc; }

#sidebar.collapsed .submenu {
    display: none !important; 
    position: absolute;
    left: 100%; top: 0;
    margin: 0; margin-left: 5px;
    width: 200px;
    z-index: 999999;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0 8px 8px 8px;
}

#sidebar.collapsed .nav-group:hover .submenu { display: block !important; }
#sidebar.collapsed .brand-text, #sidebar.collapsed .menu-text, #sidebar.collapsed .arrow { display: none; }

/* --- TOPBAR --- */
.topbar { 
    display: flex; 
    align-items: center; 
    padding: 0 20px;
    background: white; 
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    margin-left: 10px;
    flex-wrap: nowrap; /* Evita saltos bruscos en resoluciones medias */
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.time-item {
    display: flex;
    align-items: center;
    white-space: nowrap; 
    font-weight: 600;
    color: #858796;
    font-size: 0.85rem;
}

.time-item i { color: var(--primary); margin-right: 7px; font-size: 1rem; }

/* --- BOTÓN HAMBURGUESA --- */
#toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: 0.2s;
}

#toggle-btn i { color: var(--primary); }

#toggle-btn:hover {
    background-color: rgba(66, 133, 244, 0.1);
    border-radius: 8px;
}

/* --- CONTENIDO --- */
#main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1; display: flex; flex-direction: column; min-height: 100vh;
    transition: margin-left 0.3s;
}
#main-wrapper.expanded { margin-left: var(--sidebar-c); }

.container { padding: 25px; flex: 1; display: flex; }
.card { background: white; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); width: 100%; overflow: hidden; }

/* --- FOOTER --- */
.footer {
    background: white; padding: 20px; text-align: center;
    border-top: 1px solid var(--border-color);
}
.social-icons { display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; }
.social-icons a { color: #858796; font-size: 1.2rem; transition: 0.3s; text-decoration: none; }
.social-icons a:hover { color: var(--primary); transform: translateY(-3px); }

/* --- ESTILOS IFRAME WELCOME --- */
.iframe-body {
    height: 100vh; display: flex; flex-direction: column;
    justify-content: center; align-items: center; background: transparent;
    text-align: center;
    padding: 20px;
}

/* --- MÓVIL (RESPONSIVE INTEGRADO) --- */
@media (max-width: 768px) {
    /* 1. Ajustes de la Topbar (Tus originales + flexibilidad) */
    .topbar { height: auto; padding: 10px 15px; }
    
    .topbar-content { 
        flex-direction: column; 
        align-items: center; 
        gap: 8px;
        margin-left: 0;
    }
    
    .topbar-left { justify-content: center; }

    .topbar-right { 
        flex-direction: column; 
        gap: 4px; 
        width: 100%; 
        text-align: center; 
    }
    
    .time-item { font-size: 0.8rem; }
    .hide-mobile { display: none !important; }

    /* 2. EFECTO DE EMPUJE (Corregido para no encimarse) */
    /* Cuando el menú está compacto (solo iconos) */
    #main-wrapper.expanded { 
        margin-left: var(--sidebar-c) !important; 
        width: calc(100% - var(--sidebar-c)) !important;
    }

    /* Cuando el menú se ABRE (empuja el contenido) */
    #main-wrapper:not(.expanded) { 
        margin-left: var(--sidebar-w) !important; 
        width: calc(100% - var(--sidebar-w)) !important;
    }

    /* Aseguramos que el sidebar sea flexible en móvil */
    #sidebar {
        position: fixed;
        transition: width 0.3s ease;
    }

    /* 3. Estilos de contenido (Tus originales intactos) */
    .iframe-body { 
        height: auto; 
        min-height: 100vh; 
        padding: 40px 15px; 
        justify-content: flex-start; 
    }
    
    .iframe-body h1 { font-size: 1.6rem !important; }
    
    /* Tu logo original */
    #logo { 
        height: 90px !important; 
        width: 90px !important; 
    }

    /* Ajuste para que las tarjetas no se desborden al empujar */
    .container { padding: 10px; }
    .card { width: 100%; min-width: 0; }
}