/* NEXUS - Layout System (Apple Style Redesign) */

.main-content {
    display: grid;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    height: 100vh;
    background-color: var(--bg-sidebar);
    transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- HEADER --- */
.header {
    grid-area: header;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
}

.header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* --- SIDEBAR --- */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    z-index: 101;
    overflow: hidden;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem 1.5rem 0.5rem;
    transition: all 0.4s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.logo img {
    filter: drop-shadow(0 0 8px rgba(0, 113, 227, 0.3));
    width: 24px;
    height: 24px;
}

.sidebar-toggle-container span {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
}

.sidebar-toggle-container span:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Navigation List */
.menu-content ul {
    list-style: none;
}

.item-content {
    margin-bottom: 2px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md) 0 0 var(--radius-md); 
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.link-item i {
    font-size: 1.1rem;
}

.link-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.item-content.selected .link-item {
    background: var(--bg-content); 
    color: var(--accent-primary);
    position: relative;
    z-index: 102;
    margin-right: -0.85rem;
    padding-right: 1.5rem;
    font-weight: 600;
}

/* --- MAIN CONTENT AREA --- */
.content {
    grid-area: main;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-content);
    position: relative;
    border-radius: 16px 0 0 0;
    transition: all 0.4s ease;
}

.view {
    width: 100%;
    min-height: 100%;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- SIDEBAR ACTIVE (COLLAPSED) --- */
.main-content.active {
    grid-template-columns: 72px 1fr;
}

.sidebar.active {
    align-items: center;
    padding: 1.25rem 0.5rem;
}

.sidebar.active .name-item {
    display: none !important;
}

.sidebar.active .link-item {
    justify-content: center;
}

.sidebar.active .logo-container {
    flex-direction: column;
    gap: 15px;
    padding: 0.5rem 0;
    justify-content: center;
}

/* Overlay para móvil */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
}

/* Responsive */
@media (max-width: 767.98px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 1001;
        box-shadow: 20px 0 50px rgba(0,0,0,0.3);
        border-right: 1px solid var(--border-color);
        border-radius: 0 20px 20px 0;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.mobile-active {
        transform: translateX(0);
    }

    .sidebar.mobile-active .item-content {
        animation: slideInItem 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        opacity: 0;
    }

    .sidebar.mobile-active .item-content:nth-child(1) { animation-delay: 0.1s; }
    .sidebar.mobile-active .item-content:nth-child(2) { animation-delay: 0.15s; }
    .sidebar.mobile-active .item-content:nth-child(3) { animation-delay: 0.2s; }
    .sidebar.mobile-active .item-content:nth-child(4) { animation-delay: 0.25s; }

    @keyframes slideInItem {
        from { transform: translateX(-15px); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    .header {
        padding: 0 1rem;
    }

    .content {
        border-left: none;
        border-radius: 0;
        padding: 0.75rem;
    }

    .logo-container .menu {
        display: none !important;
    }

    .sidebar-toggle-container {
        display: none;
    }
}
