/* ============================================
   LAYOUT — Sidebar, Main, Login
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-header .logo {
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(250, 240, 225, 0.55) !important;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    margin: 0 10px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(250, 240, 225, 0.08);
    color: rgba(250, 240, 225, 0.9) !important;
}

.nav-link.active {
    background: rgba(139, 94, 60, 0.25);
    color: var(--primary-200) !important;
    border-left-color: var(--primary-light);
    font-weight: 600;
}

.nav-link .icon {
    font-size: 18px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: rgba(250, 240, 225, 0.7);
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.user-info .icon { opacity: 0.7; }

.sidebar .btn-secondary {
    background: rgba(250, 240, 225, 0.08);
    border: 1px solid rgba(250, 240, 225, 0.12);
    color: rgba(250, 240, 225, 0.7);
    font-size: 13px;
}

.sidebar .btn-secondary:hover {
    background: rgba(250, 240, 225, 0.15);
    color: rgba(250, 240, 225, 0.95);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    max-width: 100%;
    min-height: 100vh;
}

.container { max-width: 100%; }

/* --- PAGE HEADER --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 26px;
    color: var(--text-primary);
    font-weight: 700;
}

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

/* --- LOGIN PAGE --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
    padding: 20px;
}

/* subtle grain texture on login bg */
.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: var(--bg-card);
    padding: 44px 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 38px;
    color: var(--primary);
    font-weight: 700;
    font-family: 'Lora', Georgia, serif;
    letter-spacing: -0.5px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 28px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 16px;
    font-family: 'DM Sans', sans-serif;
}

/* --- MOBILE --- */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .page-header h1 { font-size: 22px; }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}