/**
 * ========================================================================
 * NEXUS AI - ESTRUCTURA GENERAL DE LAYOUT (SIDEBAR, HEADER Y CONTENEDOR)
 * ========================================================================
 */

.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* Sidebar Lateral */
.app-sidebar {
    width: 280px;
    height: 100%;
    background: var(--bg-darker);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-normal);
    z-index: 100;
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}
.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.nav-item:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-gradient);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

/* Área Principal */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-darkest);
}

/* Header Superior */
.app-header {
    height: 64px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.credits-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    color: #a5b4fc;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.credits-pill:hover {
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-glow);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
.user-profile-badge:hover {
    background: var(--bg-surface);
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* Contenedor de Vistas */
.app-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.view-section {
    display: none;
    height: 100%;
}
.view-section.active {
    display: block;
}

/* Backdrop móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 90;
}

/* Responsividad Tablet y Móvil */
@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .mobile-toggle {
        display: block;
    }
    .header-title {
        font-size: 16px;
    }
    .credits-pill span.credits-label {
        display: none;
    }
}
