/* ============================================================
   DON ALE — LAYOUT & APP SHELL (layout.css)
   Desktop Sidebar (250px) / Mobile Drawer (<768px) / Topbar
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--gradient-mesh);
    position: relative;
}

/* --- SIDEBAR (DESKTOP) --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 14px var(--accent-orange-glow);
    flex-shrink: 0;
}

.brand-icon i {
    width: 22px;
    height: 22px;
}

.brand-title {
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-menu {
    padding: 18px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-active);
    border-left-color: var(--accent-orange);
    font-weight: 600;
}

.nav-link i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-orange-glow);
    color: var(--accent-orange);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-hover);
}

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue-subtle);
    border: 1px solid var(--border-medium);
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* --- MAIN WRAPPER & TOPBAR --- */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color 0.3s ease;
}

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

.header-title-group h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title-group p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle de Modo Día / Noche */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    color: var(--accent-orange);
    border-color: var(--border-hover);
    background: var(--bg-active);
}

.mobile-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

/* Contenedor Principal de Vistas */
.content-body {
    padding: 26px 28px;
    flex: 1;
}

/* Backdrop del Drawer Móvil */
.drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    display: block;
    opacity: 1;
}

/* --- RESPONSIVIDAD MÓVIL (<768px) --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 270px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
    }

    .sidebar.drawer-open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .top-header {
        padding: 0 16px;
    }

    .content-body {
        padding: 16px;
    }
}
