/* ========================================
   LAYOUT & ESTRUCTURA
   Sistema de Gestión Bioingeniería
   ======================================== */

body {
    font-family: var(--font-inter);
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    display: flex; /* Para layout sidebar + content */
}

/* --- SIDEBAR DE NAVEGACIÓN --- */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%); /* Slate 800-900 */
    color: white;
    padding: 20px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    overflow-y: auto;
    transition: width 0.3s ease;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

/* Header del Sidebar */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0 10px 20px 10px;
}

.sidebar-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-header h1 {
    display: none;
}

/* Items del Menú */
.menu-section {
    margin-bottom: 15px;
}

.menu-section-title {
    padding: 10px 24px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8; /* Slate 400 */
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color 0.2s;
}

.menu-section-title:hover {
    color: #cbd5e1;
}

.menu-section-title i.chevron {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

/* Estado Colapsado */
.menu-section.is-collapsed .menu-section-title i.chevron {
    transform: rotate(-90deg);
}

.menu-group {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 500px; /* Suficiente para el contenido */
    opacity: 1;
}

.menu-section.is-collapsed .menu-group {
    max-height: 0;
    opacity: 0;
}

.sidebar.collapsed .menu-section-title {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #cbd5e1; /* Slate 300 */
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.menu-item.active {
    background: rgba(59, 130, 246, 0.1); /* Blue opacity */
    border-left-color: var(--primary-light);
    color: white;
}

.menu-item i {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px 10px;
}

.sidebar.collapsed .menu-item i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar.collapsed .menu-item .label,
.sidebar.collapsed .menu-item .status {
    display: none;
}

/* Footer Usuario */
.user-section {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem;
    max-width: 1600px; /* Ancho máximo para pantallas grandes */
    width: 100%;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: 70px;
}

/* --- UTILIDADES DE LAYOUT --- */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.breadcrumbs .separator {
    color: #cbd5e1;
    font-size: 0.8rem;
}

.breadcrumbs .section-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumbs .current {
    color: var(--text-main);
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}
