/* =========================================
   THEME VARIABLES (Emerald & Slate)
   ========================================= */
:root {
    /* --- DIMENSIONS --- */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --transition-speed: 0.3s;
    /* --- PALETTE: EMERALD (Brand) --- */
    --brand-primary: #10b981; /* Emerald 500 - Main Actions */
    --brand-dark: #047857; /* Emerald 700 - Hover States */
    --brand-light: #d1fae5; /* Emerald 100 - Backgrounds */
    --brand-accent: #34d399; /* Emerald 400 - Highlights */
    /* --- PALETTE: SLATE (UI) --- */
    --sidebar-bg: #0f172a; /* Slate 900 - Sidebar Background */
    --sidebar-item-hover: #1e293b; /* Slate 800 */
    --sidebar-text: #94a3b8; /* Slate 400 */
    --sidebar-text-active: #ffffff;
    --body-bg: #f1f5f9; /* Slate 100 - Main Background */
    --surface-bg: #ffffff; /* White - Cards/Header */
    --border-color: #e2e8f0; /* Slate 200 */
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
}

/* Dark Mode Overrides (Optional preparation) */
[data-bs-theme="dark"] {
    --body-bg: #0f172a;
    --surface-bg: #1e293b;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

/* =========================================
   GLOBAL RESET & TYPOGRAPHY
   ========================================= */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

/* Bootstrap Overrides for Brand Consistency */
.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
    font-weight: 500;
}

    .btn-primary:hover, .btn-primary:active, .btn-primary:focus {
        background-color: var(--brand-dark) !important;
        border-color: var(--brand-dark) !important;
    }

.text-success {
    color: var(--brand-primary) !important;
}

.bg-success {
    background-color: var(--brand-primary) !important;
}

/* =========================================
   SIDEBAR COMPONENT
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    overflow: hidden;
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

/* Sidebar Header */
.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    background: rgba(0,0,0,0.1);
}

    .sidebar-brand i {
        font-size: 1.4rem;
        color: var(--brand-primary); /* Emerald Icon */
        min-width: 30px;
    }

.sidebar.collapsed .sidebar-brand span {
    display: none;
}

/* Navigation Links */
.nav-link {
    color: var(--sidebar-text);
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

    .nav-link:hover {
        color: white;
        background-color: var(--sidebar-item-hover);
    }

    .nav-link.active {
        color: var(--sidebar-text-active);
        background-color: var(--sidebar-item-hover);
        border-left-color: var(--brand-primary);
    }

    .nav-link i {
        margin-right: 14px;
        font-size: 1.15rem;
        min-width: 24px;
        text-align: center;
    }

/* Collapsed State Adjustments */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

    .sidebar.collapsed .nav-link i {
        margin-right: 0;
    }

    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .nav-header,
    .sidebar.collapsed .sidebar-footer-text {
        display: none;
    }

/* Sidebar Section Headers */
.nav-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #475569; /* Slate 600 */
    padding: 1.5rem 1.5rem 0.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* =========================================
   MAIN LAYOUT & HEADER
   ========================================= */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

    .main-wrapper.expanded {
        margin-left: var(--sidebar-collapsed-width);
    }

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--surface-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

/* Content Area */
.content-body {
    padding: 2rem;
    flex: 1;
    /* Uses body-bg variable */
}

/* Footer */
.app-footer {
    padding: 1rem 2rem;
    background: var(--surface-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =========================================
   UTILITIES & COMPONENTS
   ========================================= */
.avatar-circle {
    width: 38px;
    height: 38px;
    background: var(--brand-light);
    color: var(--brand-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
}

/* Card Overrides */
.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

        .sidebar.show {
            transform: translateX(0);
        }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .desktop-toggle {
        display: none;
    }
}
