/* ==================== CSS RESET & BASE STYLES ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --bg-primary: #fafafa;
    --bg-white: #ffffff;
    --bg-off-white: #f8f9fa;
    --bg-card: #ffffff;
    --bg-dark: #0f0f1a;
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;
    
    --accent-primary: #6c5ce7;
    --accent-primary-light: #a29bfe;
    --accent-primary-dark: #5a4bd1;
    --accent-green: #00b894;
    --accent-pink: #fd79a8;
    --accent-orange: #e17055;
    --accent-gold: #d4a853;
    
    --border-light: #f0f0f0;
    --border-medium: #e5e7eb;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.3);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Layout */
    --max-width: 1200px;
    --nav-height: 72px;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== UTILITY CLASSES ==================== */
.section-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.section-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.08);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.section-title {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.section-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.gradient-text {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #fd79a8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--accent-primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: translate(0, 0); opacity: 0; }
    50% { transform: translate(10%, 10%); opacity: 1; }
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-medium);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.04);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.0625rem;
    border-radius: var(--radius-lg);
}

.btn-full {
    width: 100%;
}

/* ==================== NAVIGATION ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    transition: all var(--transition-base);
    background: transparent;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-light);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==================== DARK MODE ==================== */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-white: #1a1a2e;
    --bg-off-white: #16213e;
    --bg-card: #1a1a2e;
    --bg-dark: #0a0a14;
    
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-tertiary: #6b7280;
    --text-muted: #4b5563;
    
    --border-light: #2a2a3e;
    --border-medium: #3a3a4e;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ==================== SKELETON LOADERS ==================== */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-off-white) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: all;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid var(--accent-primary);
    max-width: 400px;
}

.toast.visible {
    transform: translateX(0);
}

.toast.toast-success { border-left-color: var(--accent-green); }
.toast.toast-error { border-left-color: #ff6b6b; }
.toast.toast-warning { border-left-color: #ffd93d; }
.toast.toast-info { border-left-color: var(--accent-primary); }

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0 4px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(0, 184, 148, 0.1); color: #00b894; }
.badge-warning { background: rgba(255, 217, 61, 0.1); color: #d4a853; }
.badge-error { background: rgba(255, 107, 107, 0.1); color: #ff6b6b; }
.badge-info { background: rgba(108, 92, 231, 0.1); color: #6c5ce7; }
.badge-neutral { background: var(--bg-off-white); color: var(--text-secondary); }

/* ==================== DARK MODE TOGGLE ==================== */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border-medium);
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border: none;
}

.theme-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.theme-toggle.dark {
    background: var(--accent-primary);
}

.theme-toggle.dark::after {
    transform: translateX(22px);
}


/* ========== DARK MODE SYSTEM ========== */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-white: #1a1a2e;
    --bg-off-white: #16213e;
    --bg-card: #1a1a2e;
    --bg-dark: #0a0a14;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-tertiary: #6b7280;
    --text-muted: #4b5563;
    --border-light: #2a2a3e;
    --border-medium: #3a3a4e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
}

/* Dark mode toggle button */
.theme-toggle-btn {
    width: 44px; height: 24px; background: var(--border-medium); border-radius: 12px;
    cursor: pointer; position: relative; transition: background 0.3s; border: none; padding: 0;
}
.theme-toggle-btn::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
    background: white; border-radius: 50%; transition: transform 0.3s;
}
.theme-toggle-btn.dark { background: var(--accent-primary); }
.theme-toggle-btn.dark::after { transform: translateX(20px); }

/* Add this to your existing /frontend/shared/css/main.css */

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-header .sidebar-logo span {
    color: var(--text-primary);
}

.sidebar-header .sidebar-logo .ent-badge {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-left: 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav .nav-item {
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.sidebar-nav .nav-item:hover {
    background: var(--bg-off-white);
    color: var(--text-primary);
    transform: translateX(4px);
}

.sidebar-nav .nav-item.active {
    background: rgba(108, 92, 231, 0.08);
    color: var(--accent-primary);
    font-weight: 600;
}

.sidebar-nav .nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.sidebar-footer strong {
    color: var(--text-primary);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== TOPBAR ==================== */
.topbar {
    padding: 12px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 64px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 8px;
}

.sidebar-toggle:hover {
    background: var(--bg-off-white);
}

/* ==================== RESPONSIVE SIDEBAR ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
        z-index: 1000;
        border-right: none;
        width: 280px;
        min-width: 280px;
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .topbar {
        padding: 12px 16px;
    }
}

/* ==================== SIDEBAR WITH OVERLAY (mobile helper) ==================== */
body.sidebar-open {
    overflow: hidden;
}

/* Fix for pages that use sidebar with main-content margin */
body.dashboard-page {
    display: flex;
    min-height: 100vh;
}

body.dashboard-page .main-content {
    margin-left: 0;
}

/* For desktop, add margin */
@media (min-width: 769px) {
    body.dashboard-page .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        transform: none !important;
    }
    
    body.dashboard-page .main-content {
        margin-left: 260px;
        flex: 1;
        min-height: 100vh;
        width: calc(100% - 260px);
    }
}