/* ==========================================================================
   GREDI - Main Stylesheet
   Complete production-ready stylesheet with universal toast system
   Refactored, sanitized, and optimized for consistency.
   ========================================================================== */

/* ==========================================================================
   1. CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
    /* === Brand Colors (Bluish Palette) === */
    --brand-primary: #3b82f6;
    --brand-primary-dark: #1d4ed8;
    --brand-primary-light: #60a5fa;
    --brand-primary-rgb: 59, 130, 246;
    
    --brand-secondary: #64748b;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --brand-danger: #ef4444;
    --brand-info: #0ea5e9;
    --brand-purple: #8b5cf6;
    
    /* === Light Mode Colors === */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-2: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-hover: rgba(59, 130, 246, 0.08);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-color-light: #f1f5f9;
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    
    /* === Typography === */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-math: 'Math Pazo', 'Times New Roman', serif;
    
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.75;
    
    --navbar-height: 70px;
    
    /* === Spacing === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* === Border Radius === */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
    
    /* === Transitions === */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-theme: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* === Z-Index Scale === */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-sidebar: 100;
    --z-skip-link: 10000;
    --z-loading: 9999;
    --z-toast: 9999;
}

/* ==========================================================================
   2. DARK MODE OVERRIDES (Global)
   ========================================================================== */

[data-theme="dark"] {
    /* === Core Design Tokens === */
    --bg-body: #0b0f19;
    --bg-surface: #1e293b;
    --bg-surface-2: #334155;
    --bg-input: #1e293b;
    --bg-hover: rgba(59, 130, 246, 0.15);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --border-color-light: #1e293b;
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    
    --sidebar-text-muted: #cbd5e1;
}

/* === GLOBAL PAGE STRUCTURE === */
[data-theme="dark"] html,
[data-theme="dark"] body {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] main,
[data-theme="dark"] #main-content,
[data-theme="dark"] .container,
[data-theme="dark"] .container-fluid {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
}

/* === TYPOGRAPHY & TEXT UTILITIES === */
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6,
[data-theme="dark"] .h1, [data-theme="dark"] .h2, [data-theme="dark"] .h3,
[data-theme="dark"] .h4, [data-theme="dark"] .h5, [data-theme="dark"] .h6,
[data-theme="dark"] p, [data-theme="dark"] span, [data-theme="dark"] div,
[data-theme="dark"] li, [data-theme="dark"] label, [data-theme="dark"] small {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] small.text-muted {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

[data-theme="dark"] a:not(.btn):not(.badge):not(.nav-link) {
    color: var(--brand-primary) !important;
}
[data-theme="dark"] a:not(.btn):not(.badge):not(.nav-link):hover {
    color: var(--brand-primary-light) !important;
}

/* === NAVIGATION & HEADER === */
[data-theme="dark"] .navbar {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .navbar .nav-link {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .navbar .nav-link:hover,
[data-theme="dark"] .navbar .nav-link.active {
    color: var(--brand-primary) !important;
}
[data-theme="dark"] .navbar-brand {
    color: var(--brand-primary) !important;
}

/* === CARDS & CONTAINERS === */
[data-theme="dark"] .card,
[data-theme="dark"] .filter-container,
[data-theme="dark"] .scheme-card,
[data-theme="dark"] .welcome-banner {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .card-header {
    background-color: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .card-footer {
    background-color: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .card-header-gradient,
[data-theme="dark"] .card-header.bg-success.bg-gradient {
    color: white !important;
}

/* === TABLES === */
[data-theme="dark"] table,
[data-theme="dark"] .table {
    --bs-table-bg: var(--bg-surface) !important;
    --bs-table-color: var(--text-primary) !important;
    --bs-table-border-color: var(--border-color) !important;
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] table th,
[data-theme="dark"] .table th {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] table td,
[data-theme="dark"] .table td {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] table tr:hover,
[data-theme="dark"] .table tr:hover {
    background-color: var(--bg-hover) !important;
}

/* === FORMS & INPUTS === */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}
[data-theme="dark"] .form-label {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .form-check-input {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .form-check-input:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

/* === DROPDOWNS === */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-lg) !important;
}
[data-theme="dark"] .dropdown-menu .dropdown-item {
    color: var(--text-primary) !important;
    background-color: transparent !important;
}
[data-theme="dark"] .dropdown-menu .dropdown-item:hover,
[data-theme="dark"] .dropdown-menu .dropdown-item:focus {
    background-color: var(--bg-hover) !important;
    color: var(--brand-primary) !important;
}
[data-theme="dark"] .dropdown-menu .dropdown-item.active,
[data-theme="dark"] .dropdown-menu .dropdown-item:active {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: var(--brand-primary-light) !important;
}
[data-theme="dark"] .dropdown-menu .text-muted,
[data-theme="dark"] .dropdown-menu small {
    color: var(--text-muted) !important;
}
[data-theme="dark"] .dropdown-menu .bg-light {
    background-color: var(--bg-surface-2) !important;
}

/* === MODALS === */
[data-theme="dark"] .modal-content {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color) !important;
    background-color: var(--bg-surface-2) !important;
}
[data-theme="dark"] .modal-title {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .modal-backdrop {
    background-color: #000 !important;
    opacity: 0.6 !important;
}
/* Global Modal Close Button Fix */
[data-theme="dark"] .modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
    opacity: 0.7 !important;
}
[data-theme="dark"] .modal .btn-close:hover {
    opacity: 1 !important;
}

/* === BADGES === */
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .badge.text-dark {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .badge.bg-white {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}
/* Preserve semantic badge colors */
[data-theme="dark"] .badge.bg-primary { background-color: var(--brand-primary) !important; color: white !important; }
[data-theme="dark"] .badge.bg-success { background-color: var(--brand-success) !important; color: white !important; }
[data-theme="dark"] .badge.bg-warning { background-color: var(--brand-warning) !important; color: white !important; }
[data-theme="dark"] .badge.bg-danger { background-color: var(--brand-danger) !important; color: white !important; }
[data-theme="dark"] .badge.bg-info { background-color: var(--brand-info) !important; color: white !important; }

/* ==========================================================================
   FIX: Bootstrap 5.3 Subtle & Emphasis Utilities for [data-theme="dark"]
   ========================================================================== */
/* 
   Bootstrap's subtle/emphasis classes rely on [data-bs-theme="dark"], which you aren't using.
   Additionally, your global [data-theme="dark"] span rule overrides Bootstrap's text color 
   due to higher CSS specificity. We must explicitly define them here.
*/

[data-theme="dark"] .text-primary-emphasis {
    color: #6ea8fe !important; /* Lighter blue for dark mode text */
}
[data-theme="dark"] .bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.15) !important; /* Darker subtle background */
}

/* Optional: Add these if you use other subtle/emphasis variants elsewhere */
[data-theme="dark"] .text-success-emphasis { color: #6ee7b7 !important; }
[data-theme="dark"] .bg-success-subtle { background-color: rgba(16, 185, 129, 0.15) !important; }

[data-theme="dark"] .text-warning-emphasis { color: #fcd34d !important; }
[data-theme="dark"] .bg-warning-subtle { background-color: rgba(245, 158, 11, 0.15) !important; }

[data-theme="dark"] .text-danger-emphasis { color: #f87171 !important; }
[data-theme="dark"] .bg-danger-subtle { background-color: rgba(239, 68, 68, 0.15) !important; }

[data-theme="dark"] .text-info-emphasis { color: #67e8f9 !important; }
[data-theme="dark"] .bg-info-subtle { background-color: rgba(14, 165, 233, 0.15) !important; }

/* === ALERTS === */
[data-theme="dark"] .alert {
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .alert-success { color: #6ee7b7 !important; }
[data-theme="dark"] .alert-warning { color: #fcd34d !important; }
[data-theme="dark"] .alert-danger { color: #f87171 !important; }
[data-theme="dark"] .alert-info { color: #67e8f9 !important; }

/* === BUTTONS === */
[data-theme="dark"] .btn-outline-primary {
    color: var(--brand-primary) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-success:hover,
[data-theme="dark"] .btn-outline-danger:hover,
[data-theme="dark"] .btn-outline-warning:hover,
[data-theme="dark"] .btn-outline-info:hover {
    color: white !important;
    fill: white !important;
}

/* === FOOTER === */
[data-theme="dark"] footer {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] footer a {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] footer a:hover {
    color: var(--brand-primary) !important;
}

/* === UTILITY OVERRIDES === */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light {
    background-color: var(--bg-surface) !important;
}
[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .border-top {
    border-top-color: var(--border-color) !important;
}
[data-theme="dark"] .border-bottom {
    border-bottom-color: var(--border-color) !important;
}

/* === SCHEMES PAGE SPECIFICS === */
[data-theme="dark"] .schemes-header,
[data-theme="dark"] .page-header {
    background: transparent !important;
}
[data-theme="dark"] .strands-preview li {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .scheme-meta {
    border-top-color: var(--border-color) !important;
}

/* === ACCESSIBILITY: Focus States === */
[data-theme="dark"] a:focus,
[data-theme="dark"] button:focus,
[data-theme="dark"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3) !important;
}

/* AI Modal Dark Mode Support */
[data-theme="dark"] #aiConfirmModal .modal-content {
    background: var(--bg-surface, #1e293b) !important;
    border: 1px solid var(--border-color, #334155) !important;
    color: var(--text-primary, #f1f5f9) !important;
}
[data-theme="dark"] #aiConfirmModal .modal-header,
[data-theme="dark"] #aiConfirmModal .modal-footer {
    border-color: var(--border-color, #334155) !important;
}
[data-theme="dark"] #aiConfirmModal .bg-light {
    background: var(--bg-surface-2, #334155) !important;
    color: var(--text-muted, #94a3b8) !important;
}
[data-theme="dark"] #aiConfirmModal .btn-light {
    background: var(--bg-surface-2, #334155) !important;
    color: var(--text-primary, #f1f5f9) !important;
    border-color: var(--border-color, #475569) !important;
}
[data-theme="dark"] #aiConfirmModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* === Rubric Options Dark Mode Fix === */
[data-theme="dark"] .rubric-option {
    background-color: var(--bg-surface-2) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .rubric-option .text-muted {
    color: var(--text-muted) !important;
}
[data-theme="dark"] .rubric-option .form-check-input {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
}

/* ==========================================================================
   3. DARK MODE: Toast System Fixes
   ========================================================================== */

[data-theme="dark"] .toast,
[data-theme="dark"] .toast-container {
    --bs-toast-bg: var(--bg-surface) !important;
    --bs-toast-color: var(--text-primary) !important;
    --bs-toast-border-color: var(--border-color) !important;
    --bs-toast-header-color: var(--text-secondary) !important;
    --bs-toast-header-bg: var(--bg-surface-2) !important;
    --bs-toast-header-border-color: var(--border-color) !important;
    
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-xl) !important;
}

[data-theme="dark"] .toast-header {
    background-color: var(--bg-surface-2) !important;
    border-bottom-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .toast-body {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .toast .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
    opacity: 0.7 !important;
}
[data-theme="dark"] .toast .btn-close:hover {
    opacity: 1 !important;
    filter: invert(1) grayscale(100%) brightness(250%) !important;
}

[data-theme="dark"] .toast-success {
    border-left-color: var(--brand-success) !important;
    background-color: rgba(16, 185, 129, 0.08) !important;
}
[data-theme="dark"] .toast-success .toast-header {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .toast-error {
    border-left-color: var(--brand-danger) !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
}
[data-theme="dark"] .toast-error .toast-header {
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .toast-warning {
    border-left-color: var(--brand-warning) !important;
    background-color: rgba(245, 158, 11, 0.08) !important;
}
[data-theme="dark"] .toast-warning .toast-header {
    background-color: rgba(245, 158, 11, 0.12) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .toast-info {
    border-left-color: var(--brand-info) !important;
    background-color: rgba(14, 165, 233, 0.08) !important;
}
[data-theme="dark"] .toast-info .toast-header {
    background-color: rgba(14, 165, 233, 0.12) !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .toast-title {
    color: var(--text-primary) !important;
    font-weight: var(--font-weight-semibold) !important;
}
[data-theme="dark"] .toast-message {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .toast-container {
    z-index: var(--z-toast) !important;
}

[data-theme="dark"] .toast.show {
    opacity: 1 !important;
    transform: translateX(0) !important;
}
[data-theme="dark"] .toast.hide {
    opacity: 0 !important;
    transform: translateX(20px) !important;
}

/* ==========================================================================
   4. DARK MODE: Inline-Style Toast Overrides
   ========================================================================== */

[data-theme="dark"] .alert.position-fixed {
    box-shadow: var(--shadow-xl) !important;
}

[data-theme="dark"] .alert.alert-success {
    background-color: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #6ee7b7 !important;
}
[data-theme="dark"] .alert.alert-danger {
    background-color: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}
[data-theme="dark"] .alert.alert-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
}
[data-theme="dark"] .alert.alert-info {
    background-color: rgba(14, 165, 233, 0.12) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .alert .text-success { color: #34d399 !important; }
[data-theme="dark"] .alert .text-danger { color: #f87171 !important; }
[data-theme="dark"] .alert .text-warning { color: #fbbf24 !important; }
[data-theme="dark"] .alert .text-info { color: #38bdf8 !important; }

[data-theme="dark"] .alert span {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .alert.position-fixed {
    transition: opacity var(--transition-normal), transform var(--transition-normal) !important;
}

/* ==========================================================================
   5. Base Styles & Reset
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-padding-top: var(--navbar-height);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-body);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.has-fixed-navbar {
    padding-top: var(--navbar-height);
}

@media (max-width: 991.98px) {
    body.has-fixed-navbar {
        padding-top: calc(var(--navbar-height) + 20px);
    }
}

/* ==========================================================================
   6. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-3);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-primary-dark);
    text-decoration: underline;
}

.text-primary { color: var(--brand-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--brand-success) !important; }
.text-warning { color: var(--brand-warning) !important; }
.text-danger { color: var(--brand-danger) !important; }

.font-math { font-family: var(--font-math); }
.font-mono { font-family: var(--font-mono); }

/* ==========================================================================
   7. Toast Base Styles
   ========================================================================== */

.toast {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
    border-left: 4px solid var(--brand-info) !important;
    min-width: 280px;
}

.toast-header {
    background: var(--bg-surface-2) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    padding: 0.75rem 1rem;
    font-weight: var(--font-weight-medium);
}

.toast-body {
    color: var(--text-primary) !important;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.toast .btn-close {
    filter: none;
    opacity: 0.5;
    padding: 0.5rem;
}

.toast .btn-close:hover {
    opacity: 1;
}

/* ==========================================================================
   8. Toast Type Variants
   ========================================================================== */

.toast-success { border-left-color: var(--brand-success) !important; }
.toast-success .toast-header { background: rgba(16, 185, 129, 0.1) !important; }
.toast-success .toast-title { color: var(--brand-success) !important; }

.toast-error { border-left-color: var(--brand-danger) !important; }
.toast-error .toast-header { background: rgba(239, 68, 68, 0.1) !important; }
.toast-error .toast-title { color: var(--brand-danger) !important; }

.toast-warning { border-left-color: var(--brand-warning) !important; }
.toast-warning .toast-header { background: rgba(245, 158, 11, 0.1) !important; }
.toast-warning .toast-title { color: var(--brand-warning) !important; }

.toast-info { border-left-color: var(--brand-info) !important; }
.toast-info .toast-header { background: rgba(14, 165, 233, 0.1) !important; }
.toast-info .toast-title { color: var(--brand-info) !important; }

/* ==========================================================================
   9. Toast Animation
   ========================================================================== */

.toast {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(20px);
}

/* ==========================================================================
   10. Cards
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: none !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-normal), transform var(--transition-fast);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color) !important;
    padding: var(--space-4) var(--space-5);
    font-weight: var(--font-weight-semibold);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    background: var(--bg-surface-2);
    border-top: 1px solid var(--border-color) !important;
    padding: var(--space-4) var(--space-5);
}

.card-primary { border-left: 4px solid var(--brand-primary) !important; }
.card-success { border-left: 4px solid var(--brand-success) !important; }
.card-warning { border-left: 4px solid var(--brand-warning) !important; }
.card-danger { border-left: 4px solid var(--brand-danger) !important; }

/* ==========================================================================
   Sleek Activity Cards (Accordion Alternative)
   ========================================================================== */

.activity-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

/* Hover Lift Effect */
.activity-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary-light);
}

/* Variant: Success */
.activity-card-success {
    border-left-color: var(--brand-success);
}
.activity-card-success:hover {
    border-color: #34d399; /* Lighter success green */
}

/* Variant: Warning */
.activity-card-warning {
    border-left-color: var(--brand-warning);
}
.activity-card-warning:hover {
    border-color: #fbbf24;
}

.activity-card-inner {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-5);
    align-items: flex-start;
}

/* Icon Wrapper */
.activity-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(var(--brand-primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.activity-card:hover .activity-icon-wrapper {
    transform: scale(1.05);
}

.activity-icon {
    font-size: 1.25rem;
    color: var(--brand-primary);
}

/* Content Area */
.activity-content {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
    flex-wrap: wrap;
}

.activity-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
    line-height: var(--line-height-tight);
}

.activity-description {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    margin-bottom: var(--space-3);
}

/* Optional Footer Link */
.activity-footer {
    margin-top: var(--space-2);
}

.activity-link {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--brand-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: gap var(--transition-fast), color var(--transition-fast);
}

.activity-link:hover {
    color: var(--brand-primary-dark);
    gap: 6px; /* Smooth arrow slide effect */
    text-decoration: none;
}

.activity-link i {
    font-size: 1.1rem;
    transition: transform var(--transition-fast);
}

.activity-link:hover i {
    transform: translateX(2px);
}

/* ==========================================================================
   Dark Mode Tweaks for Sleek Cards
   ========================================================================== */
[data-theme="dark"] .activity-card {
    /* Slightly lighter border in dark mode for better definition */
    border-color: rgba(255, 255, 255, 0.08); 
}

[data-theme="dark"] .activity-card:hover {
    border-color: var(--brand-primary);
    background: var(--bg-surface-2); /* Subtle background shift on hover in dark mode */
}

[data-theme="dark"] .activity-card-success:hover {
    border-color: var(--brand-success);
    background: rgba(16, 185, 129, 0.05);
}

/* Ensure badges inside the card use the correct dark mode emphasis colors */
[data-theme="dark"] .text-primary-emphasis { color: #6ea8fe !important; }
[data-theme="dark"] .text-success-emphasis { color: #6ee7b7 !important; }
[data-theme="dark"] .text-warning-emphasis { color: #fcd34d !important; }

/* ==========================================================================
   11. Buttons
   ========================================================================== */

.btn {
    font-weight: var(--font-weight-medium);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.4);
    color: white;
    text-decoration: none;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--brand-primary);
    color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

.btn-secondary {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-success { background: var(--brand-success); border: none; color: white; }
.btn-warning { background: var(--brand-warning); border: none; color: white; }
.btn-danger { background: var(--brand-danger); border: none; color: white; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: var(--font-size-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: var(--font-size-lg); }
.btn-block { width: 100%; }

/* Button with Icon Utility */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.btn-icon:hover {
    transform: scale(1.05);
}

.btn-icon.btn-light {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-icon.btn-light:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   12. Forms
   ========================================================================== */

.form-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    display: block;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
    background: var(--bg-surface);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--bg-surface-2);
    opacity: 0.7;
    cursor: not-allowed;
}

.form-text {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--brand-danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--brand-danger);
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Password Toggle */
.form-password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    z-index: 10;
}

.password-toggle:hover {
    color: var(--brand-primary);
    background: var(--bg-hover);
}

.password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.25);
}

/* Remember Me Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 0;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.25);
}

.form-check-label {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   13. Tables
   ========================================================================== */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    border: none !important;
    margin-bottom: 0;
}

.table th {
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 2px solid var(--border-color) !important;
    background: var(--bg-surface-2);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color) !important;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: var(--bg-hover);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(var(--brand-primary-rgb), 0.03);
}

.table-sm th,
.table-sm td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
}

/* DataTables Integration */
.dataTables_wrapper {
    padding: var(--space-4);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: var(--space-4);
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    padding-top: var(--space-3);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--brand-primary) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-hover) !important;
    color: var(--brand-primary) !important;
}

/* ==========================================================================
   14. Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: var(--font-weight-medium);
    padding: 0.35rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
}

.badge.bg-primary { background: var(--brand-primary) !important; }
.badge.bg-success { background: var(--brand-success) !important; }
.badge.bg-warning { background: var(--brand-warning) !important; color: white !important; }
.badge.bg-danger { background: var(--brand-danger) !important; }
.badge.bg-secondary { background: var(--brand-secondary) !important; }
.badge.bg-info { background: var(--brand-info) !important; }

/* ==========================================================================
   15. Progress Bars
   ========================================================================== */

.progress {
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    color: white;
    font-weight: var(--font-weight-semibold);
}

.progress-bar.bg-success { background: linear-gradient(90deg, var(--brand-success), #34d399); }
.progress-bar.bg-warning { background: linear-gradient(90deg, var(--brand-warning), #fbbf24); }
.progress-bar.bg-danger { background: linear-gradient(90deg, var(--brand-danger), #f87171); }

/* ==========================================================================
   16. Alerts
   ========================================================================== */

.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.alert-content {
    flex-grow: 1;
}

.alert-success { background: rgba(16, 185, 129, 0.12); color: #065f46; }
.alert-warning { background: rgba(245, 158, 11, 0.12); color: #92400e; }
.alert-danger { background: rgba(239, 68, 68, 0.12); color: #991b1b; }
.alert-info { background: rgba(14, 165, 233, 0.12); color: #075985; }

.btn-close {
    filter: none;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* ==========================================================================
   17. Navbar & Navigation
   ========================================================================== */

.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-3) 0;
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.navbar-brand {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xl);
    color: var(--brand-primary) !important;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.navbar-brand:hover {
    color: var(--brand-primary-dark) !important;
    text-decoration: none;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: var(--font-weight-medium);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--brand-primary) !important;
    background: var(--bg-hover);
    text-decoration: none;
}

.avatar-img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: var(--radius-full);
    border: 2px solid var(--border-color);
}

.dropdown-menu {
    background: var(--bg-surface);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    margin-top: var(--space-2);
    min-width: 220px;
}

.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-weight-medium);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--brand-primary);
    text-decoration: none;
}

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--brand-danger);
}

.dropdown-item.active {
    background: var(--bg-hover);
    color: var(--brand-primary);
}

.dropdown-divider {
    border-color: var(--border-color) !important;
    margin: var(--space-2) 0;
}

/* ==========================================================================
   18. Sidebar Navigation
   ========================================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --sidebar-footer-height: 72px;
    
    --sidebar-bg: var(--bg-surface);
    --sidebar-border: var(--border-color);
    --sidebar-text: var(--text-secondary);
    --sidebar-text-muted: var(--text-muted);
    --sidebar-hover-bg: var(--bg-hover);
    --sidebar-active-bg: rgba(var(--brand-primary-rgb), 0.1);
    --sidebar-active-text: var(--brand-primary);
    --sidebar-active-border: var(--brand-primary);
    --sidebar-footer-bg: var(--bg-surface-2);
    --sidebar-footer-text: var(--brand-danger);
    --sidebar-footer-hover-bg: rgba(239, 68, 68, 0.1);
    --sidebar-footer-hover-text: var(--brand-danger);
    --sidebar-section-border: var(--border-color);
    --sidebar-section-title: var(--text-muted);
    --sidebar-shadow: var(--shadow-sm);
}

[data-theme="dark"] {
    --sidebar-bg: var(--bg-surface);
    --sidebar-border: var(--border-color);
    --sidebar-text: var(--text-secondary);
    --sidebar-text-muted: var(--text-muted);
    --sidebar-hover-bg: var(--bg-hover);
    --sidebar-active-bg: rgba(var(--brand-primary-rgb), 0.2);
    --sidebar-active-text: var(--brand-primary-light);
    --sidebar-active-border: var(--brand-primary-light);
    --sidebar-footer-bg: var(--bg-surface-2);
    --sidebar-footer-text: #f87171;
    --sidebar-footer-hover-bg: rgba(248, 113, 113, 0.15);
    --sidebar-footer-hover-text: #fca5a5;
    --sidebar-section-border: var(--border-color);
    --sidebar-section-title: var(--text-muted);
    --sidebar-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#dashboard-container {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
    margin-top: 0;
    gap: 0;
    position: relative;
}

#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    transition: width var(--transition-normal);
    flex-shrink: 0;
    position: relative;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
    box-shadow: var(--sidebar-shadow);
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

#sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 1px;
    background: var(--sidebar-border);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

#sidebar.collapsed::after {
    opacity: 1;
}

#sidebar .user-info {
    padding: var(--space-5) var(--space-4) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: var(--space-3);
    min-width: 0;
}

#sidebar .avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    flex-shrink: 0;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.2);
}

#sidebar .avatar-placeholder:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(var(--brand-primary-rgb), 0.3);
}

#sidebar .avatar-placeholder img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

#sidebar .user-details {
    min-width: 0;
    flex: 1;
}

#sidebar .user-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sidebar .user-email {
    font-size: var(--font-size-xs);
    color: var(--sidebar-text-muted);
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.875rem var(--space-4);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    transition: background-color var(--transition-fast), color var(--transition-fast), padding-left var(--transition-fast);
    border-radius: var(--radius-md);
    margin: 0 var(--space-2) var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

#sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--sidebar-active-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: height var(--transition-fast);
}

#sidebar .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-primary);
    text-decoration: none;
}

#sidebar .nav-link:hover::before {
    height: 60%;
}

#sidebar .nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

#sidebar .nav-link:hover i {
    transform: scale(1.1);
}

#sidebar .nav-link.active {
    background-color: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-text) !important;
    border-left: 3px solid var(--sidebar-active-border) !important;
    padding-left: calc(var(--space-4) - 3px) !important;
    font-weight: var(--font-weight-semibold);
}

#sidebar .nav-link.active::before {
    height: 0 !important;
}

#sidebar .nav-link.active i {
    transform: scale(1.1);
    color: var(--sidebar-active-text);
}

#sidebar.collapsed .nav-text,
#sidebar.collapsed .user-details,
#sidebar.collapsed .sidebar-section-title {
    display: none !important;
}

#sidebar.collapsed .user-info {
    justify-content: center;
    padding: var(--space-4) 0 var(--space-3);
}

#sidebar.collapsed .nav-item .nav-link {
    justify-content: center;
    padding: 0.875rem !important;
    margin: var(--space-1) var(--space-2);
    border-left: none !important;
}

#sidebar.collapsed .nav-item .nav-link::before {
    display: none !important;
}

#sidebar.collapsed .avatar-placeholder {
    margin: 0 auto var(--space-3);
    width: 36px;
    height: 36px;
    font-size: var(--font-size-sm);
}

#sidebar.collapsed .nav-link.active {
    background-color: var(--sidebar-active-bg) !important;
    border-left: none !important;
    padding: 0.875rem !important;
}

#sidebar.collapsed .nav-link.active i {
    transform: scale(1.1);
    color: var(--sidebar-active-text);
}

#sidebar .sidebar-section {
    padding: var(--space-2) 0 var(--space-3) var(--space-4);
    margin-top: var(--space-2);
    border-top: 1px solid var(--sidebar-section-border);
}

#sidebar .sidebar-section:first-child {
    border-top: none;
    padding-top: 0;
}

#sidebar .sidebar-section-title {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-section-title);
    font-weight: var(--font-weight-semibold);
    padding-left: var(--space-1);
    margin-bottom: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#sidebar .sidebar-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sidebar-section-border);
    margin-left: var(--space-2);
}

#sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: var(--space-3) var(--space-4);
    margin-top: auto;
    background: var(--sidebar-footer-bg);
}

#sidebar-footer .nav-link {
    color: var(--sidebar-footer-text);
    padding: var(--space-2) 0;
    margin: 0;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

#sidebar-footer .nav-link:hover {
    background: var(--sidebar-footer-hover-bg);
    color: var(--sidebar-footer-hover-text);
    text-decoration: none;
}

#sidebar-footer .nav-link i {
    transition: transform var(--transition-fast);
}

#sidebar-footer .nav-link:hover i {
    transform: translateX(2px);
}

#main-content {
    flex: 1;
    padding: var(--space-6);
    background-color: var(--bg-body);
    min-width: 0;
    transition: padding var(--transition-normal);
}

#mobile-sidebar-toggle,
#desktop-collapse-toggle {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-left: var(--space-2);
}

#mobile-sidebar-toggle:hover,
#desktop-collapse-toggle:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
    transform: translateY(-1px);
}

#mobile-sidebar-toggle:active,
#desktop-collapse-toggle:active {
    transform: translateY(0);
}

#mobile-sidebar-toggle:focus,
#desktop-collapse-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.25);
}

#collapse-icon {
    transition: transform var(--transition-normal);
}

#sidebar.collapsed #collapse-icon {
    transform: rotate(180deg);
}

@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        height: calc(100vh - var(--navbar-height));
        transform: translateX(-100%);
        z-index: var(--z-sticky);
        box-shadow: var(--shadow-xl);
        width: var(--sidebar-width) !important;
        transition: transform var(--transition-normal);
    }
    
    #sidebar.show {
        transform: translateX(0);
    }
    
    #main-content {
        padding: var(--space-4);
    }
    
    #desktop-collapse-toggle {
        display: none !important;
    }
    
    #sidebar.show::before {
        content: '';
        position: fixed;
        top: var(--navbar-height);
        left: var(--sidebar-width);
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
        animation: fadeIn 0.2s ease;
    }
}

@media (max-width: 991.98px) {
    #mobile-sidebar-toggle { display: flex; }
    #desktop-collapse-toggle { display: none; }
}

@media (min-width: 992px) {
    #mobile-sidebar-toggle { display: none; }
}

#sidebar .analytics-card {
    background: var(--bg-surface-2);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin: var(--space-2);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

#sidebar .analytics-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#sidebar .analytics-card .stat-icon {
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(var(--brand-primary-rgb), 0.1);
    color: var(--brand-primary);
    transition: transform var(--transition-fast);
}

#sidebar .analytics-card:hover .stat-icon {
    transform: scale(1.1);
}

#sidebar .analytics-card .stat-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

#sidebar .analytics-card .stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
#sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

#sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#sidebar .nav-link:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

#sidebar .nav-link:focus:not(:focus-visible) { outline: none; }
#sidebar .nav-link:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

#mobile-sidebar-toggle:focus-visible,
#desktop-collapse-toggle:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   19. Loading States
   ========================================================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loading);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-surface-2);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: var(--space-4);
    font-weight: var(--font-weight-medium);
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-hover) 50%, var(--bg-surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
    color: transparent !important;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   20. Social Login Buttons
   ========================================================================== */

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    width: 100%;
}

.btn-social:hover {
    background: var(--bg-surface-2);
    text-decoration: none;
    border-color: var(--text-muted);
}

.btn-social-google { color: #ea4335; }
.btn-social-google:hover { background: #f8f9fa; }

.btn-social-facebook { color: #1877f2; }
.btn-social-facebook:hover { background: #f0f2f5; }

.btn-social-apple { color: #000; }
[data-theme="dark"] .btn-social-apple { color: white; }

.social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--space-5) 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.social-divider span {
    padding: 0 var(--space-3);
}

/* ==========================================================================
   21. Footer
   ========================================================================== */

footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: var(--space-10) 0 var(--space-6);
    margin-top: var(--space-12);
}

footer h6 {
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

footer ul li {
    margin-bottom: var(--space-2);
}

footer ul li a {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

footer ul li a:hover {
    color: var(--brand-primary);
    text-decoration: none;
}

.hover-primary:hover {
    color: var(--brand-primary) !important;
}

/* ==========================================================================
   22. Print Styles
   ========================================================================== */

@media print {
    .no-print,
    .navbar,
    footer,
    .btn,
    .alert,
    .loading-overlay,
    #toast-container,
    #sidebar,
    #mobile-sidebar-toggle,
    #desktop-collapse-toggle,
    .theme-toggle {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    #main-content {
        padding: 0;
        min-width: auto;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    .table {
        border: 1px solid #ddd !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #ddd !important;
    }
}

/* ==========================================================================
   23. Responsive Utilities
   ========================================================================== */

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--bg-surface);
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        margin-top: var(--space-2);
        box-shadow: var(--shadow-md);
    }
    
    .navbar-nav {
        gap: var(--space-1);
    }
}

@media (max-width: 575.98px) {
    :root {
        --font-size-base: 0.9375rem;
    }
    
    .card-body {
        padding: var(--space-4);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   24. Utility Classes
   ========================================================================== */

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.flex-grow-1 { flex-grow: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.fw-normal { font-weight: var(--font-weight-normal); }
.fw-medium { font-weight: var(--font-weight-medium); }
.fw-semibold { font-weight: var(--font-weight-semibold); }
.fw-bold { font-weight: var(--font-weight-bold); }

.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

@media (min-width: 992px) {
    .d-lg-none { display: none; }
    .d-lg-block { display: block; }
    .d-lg-inline { display: inline; }
}

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.cursor-pointer { cursor: pointer; }

/* ==========================================================================
   25. CBC Planner Specific Components
   ========================================================================== */

.scheme-card {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.scheme-card:hover {
    transform: translateY(-2px);
}

.scheme-card .card-body {
    padding: var(--space-5);
}

.scheme-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.scheme-badge {
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.5rem;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.ai-card {
    border: 2px solid var(--brand-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(29, 78, 216, 0.05));
}

.ai-badge {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-purple));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.download-progress {
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    padding: var(--space-3);
    margin-top: var(--space-3);
}

.download-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.tier-card {
    position: relative;
    overflow: hidden;
}

.tier-card.popular {
    border: 2px solid var(--brand-primary);
}

.tier-card.popular::before {
    content: 'Most Popular';
    position: absolute;
    top: var(--space-3);
    right: -30px;
    background: var(--brand-primary);
    color: white;
    padding: 0.25rem 2.5rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    transform: rotate(45deg);
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.feature-list li i {
    color: var(--brand-success);
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-list li.disabled {
    color: var(--text-muted);
    text-decoration: line-through;
}

.feature-list li.disabled i {
    color: var(--text-muted);
}

/* ==========================================================================
   26. Animations
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.4s ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* ==========================================================================
   27. Accessibility
   ========================================================================== */

a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-primary);
    color: white;
    padding: 8px;
    z-index: var(--z-skip-link);
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   28. Dark Mode Toggle Button (Global FAB)
   ========================================================================== */

.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-md);
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.4);
}

.theme-toggle i {
    transition: transform var(--transition-fast);
}

.theme-toggle:hover i {
    transform: scale(1.1);
}

[data-theme="dark"] .theme-toggle i.bi-moon-stars-fill::before {
    content: "\f43c";
}

.theme-toggle .bi-moon-stars-fill,
.theme-toggle .bi-sun-fill {
    transition: opacity var(--transition-fast);
}

.theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-sun-fill { display: inline-block; }

@media (max-width: 575.98px) {
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* ==========================================================================
   29. Theme Transition Animations
   ========================================================================== */

html,
body,
.card,
.section,
.content-card,
.lesson-plan-card,
.navbar,
.dropdown-menu,
.modal-content,
.toast,
.btn,
.form-control,
.form-select,
.table,
thead,
tbody,
tr,
td,
th,
a:not(.btn),
.text-primary,
.text-secondary,
.text-muted,
.border,
.border-top,
.border-bottom,
.bg-surface,
.bg-surface-2,
.bg-body {
    transition: 
        background-color var(--transition-theme),
        border-color var(--transition-theme),
        color var(--transition-theme),
        box-shadow var(--transition-normal),
        fill var(--transition-normal),
        stroke var(--transition-normal) !important;
}

.theme-toggle:active {
    transform: scale(0.92) !important;
}

.theme-toggle.theme-changing {
    animation: themePulse 0.3s ease-in-out;
}

@keyframes themePulse {
    0% { transform: scale(1); box-shadow: var(--shadow-md); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(var(--brand-primary-rgb), 0.3); }
    100% { transform: scale(1); box-shadow: var(--shadow-lg); }
}

.theme-transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    opacity: 0;
    pointer-events: none;
    z-index: var(--z-loading);
    transition: opacity 0.2s ease;
}

.theme-transition-overlay.active {
    opacity: 0.15;
}

/* ==========================================================================
   30. Landing Page Specific Styles
   ========================================================================== */

.hero-section {
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-surface-2) 100%);
    padding: var(--space-12) 0 var(--space-10);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, var(--bg-body) 0%, #1e293b 100%);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 150%;
    background: radial-gradient(circle, rgba(var(--brand-primary-rgb), 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-section > .container {
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-4);
}

.hero-section .lead {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
    flex-shrink: 0;
}

.feature-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    height: 100%;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.feature-card h4 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-2);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.step-number {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    border: 3px solid var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--brand-primary);
    background: var(--bg-surface);
    margin: 0 auto var(--space-3);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.step-card:hover .step-number {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(var(--brand-primary-rgb), 0.2);
}

.step-card h4 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-2);
}

.step-card p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.testimonial-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    height: 100%;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.testimonial-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.testimonial-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.testimonial-avatar.bg-primary-subtle {
    background: rgba(var(--brand-primary-rgb), 0.1) !important;
    color: var(--brand-primary) !important;
}

.testimonial-avatar.bg-success-subtle {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--brand-success) !important;
}

.testimonial-avatar.bg-warning-subtle {
    background: rgba(245, 158, 11, 0.1) !important;
    color: var(--brand-warning) !important;
}

.testimonial-quote {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: var(--line-height-relaxed);
}

.pricing-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    height: 100%;
    position: relative;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    border: 1px solid var(--border-color);
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.pricing-card.popular {
    border: 2px solid var(--brand-primary);
    box-shadow: var(--shadow-lg);
}

.pricing-card.popular::before {
    content: 'Most Popular';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--brand-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-full);
}

.pricing-card .display-6 {
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-3);
}

.pricing-card .fs-6 {
    color: var(--text-muted);
    font-weight: var(--font-weight-normal);
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
    text-align: start;
}

.pricing-card ul li {
    padding: var(--space-2) 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--border-color-light);
}

.pricing-card ul li:last-child {
    border-bottom: none;
}

.pricing-card ul li.text-muted {
    opacity: 0.7;
}

.cta-section {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    border-radius: var(--radius-2xl);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: white;
}

.cta-section h3 {
    color: white;
    margin-bottom: var(--space-3);
}

.cta-section p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-5);
    font-size: var(--font-size-lg);
}

.cta-section .btn-light {
    background: white;
    color: var(--brand-primary);
    border: none;
    font-weight: var(--font-weight-semibold);
}

.cta-section .btn-light:hover {
    background: var(--bg-surface-2);
    color: var(--brand-primary-dark);
}

.cta-section .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    font-weight: var(--font-weight-medium);
}

.cta-section .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

footer.landing-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: var(--space-10) 0 var(--space-6);
    margin-top: var(--space-12);
}

footer.landing-footer .form-control {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

footer.landing-footer .form-control::placeholder {
    color: var(--text-muted);
}

footer.landing-footer .btn-primary {
    background: var(--brand-primary);
    border: none;
}

footer.landing-footer .btn-primary:hover {
    background: var(--brand-primary-dark);
}

#demoModal .modal-content {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

#demoModal .ratio {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface-2);
}

#demoModal .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .feature-card,
[data-theme="dark"] .testimonial-card,
[data-theme="dark"] .pricing-card {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

[data-theme="dark"] .step-number {
    background: var(--bg-surface);
    border-color: var(--brand-primary-light);
    color: var(--brand-primary-light);
}

[data-theme="dark"] .pricing-card.popular::before {
    background: var(--brand-primary-light);
}

[data-theme="dark"] .pricing-card ul li {
    border-color: var(--border-color-light);
}

[data-theme="dark"] .cta-section {
    background: linear-gradient(135deg, var(--brand-primary-dark), #1e3a8a);
}

[data-theme="dark"] .cta-section .btn-light {
    background: var(--bg-surface);
    color: var(--brand-primary);
}

[data-theme="dark"] .cta-section .btn-outline-light {
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .cta-section .btn-outline-light:hover {
    background: var(--bg-hover);
    border-color: var(--brand-primary);
}

@media (max-width: 767.98px) {
    .hero-section {
        padding: var(--space-8) 0 var(--space-6);
    }
    
    .hero-section h1 {
        font-size: var(--font-size-2xl) !important;
    }
    
    .feature-card,
    .testimonial-card,
    .pricing-card {
        padding: var(--space-4);
    }
    
    .step-number {
        width: 56px;
        height: 56px;
        font-size: var(--font-size-xl);
    }
    
    .cta-section {
        padding: var(--space-6) var(--space-4);
    }
}

.landing-page .container,
.landing-page .container-fluid {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 768px) {
    .landing-page .container,
    .landing-page .container-fluid {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 1200px) {
    .landing-page .container {
        max-width: 1140px;
    }
}

/* ==========================================================================
   31. Navbar Spacing Fixes
   ========================================================================== */

.landing-page body.has-fixed-navbar {
    padding-top: 0 !important;
}

.landing-page .navbar.fixed-top {
    position: relative !important;
    top: 0 !important;
    margin-bottom: 0 !important;
}

.navbar {
    margin-bottom: 0 !important;
}

.navbar.fixed-top {
    top: 0;
    margin: 0;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 0 !important;
        padding-top: var(--space-2) !important;
    }
}

.landing-page #app-root {
    flex-direction: column !important;
    height: auto !important;
    min-height: 100vh !important;
}

.landing-page main[role="main"] {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

.landing-page .hero-section {
    margin-top: 0 !important;
    padding-top: var(--space-10) !important;
}

@media (max-width: 767.98px) {
    .landing-page .hero-section {
        padding-top: var(--space-8) !important;
    }
}

/* ==========================================================================
   GLOBAL: Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    #sidebar,
    #sidebar .nav-link,
    #sidebar .avatar-placeholder,
    .stat-card,
    .hover-lift,
    .purchase-card,
    #collapse-icon,
    .btn-icon,
    .theme-toggle,
    .theme-toggle i {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    
    .theme-transition-overlay {
        display: none !important;
    }
}

/* ==========================================================================
   GLOBAL: High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .theme-toggle {
        border-width: 3px;
        box-shadow: 0 0 0 2px var(--text-primary);
    }
    
    html, body, .card, .section {
        transition-duration: 0.1s !important;
    }
}