:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #0d9488;
    --accent: #f59e0b;
    --background: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --container-padding: 4rem;
}

[data-theme="dark"] {
    --background: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --white: #1e293b;
    --card-bg: #1e293b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, border-color 0.3s, color 0.15s;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
}

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

.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s;
    overflow-x: hidden;
    z-index: 100;
}

.sidebar.collapsed {
    width: 80px;
    padding: 2rem 1rem;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    transition: margin-left 0.3s;
}

.sidebar.collapsed .sidebar-logo h2,
.sidebar.collapsed .sidebar-logo p,
.sidebar.collapsed .menu-link span,
.sidebar.collapsed .role-badge,
.sidebar.collapsed .user-profile p,
.sidebar.collapsed .demo-switcher {
    display: none;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 0.75rem 0;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 0.75rem 0;
}

.header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Typography */
h1 { font-size: 1.875rem; font-weight: 700; color: var(--primary); }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }

/* Components */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Dashboard Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
}

.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Sidebar Menu */
.menu-list { list-style: none; margin-top: 2rem; }
.menu-item { margin-bottom: 0.5rem; }
.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
}
.menu-link:hover, .menu-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Theme Switcher */
.theme-toggle {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Landing Page Styles */
.landing-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.hero {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at top right, rgba(30, 64, 175, 0.1), transparent),
                radial-gradient(circle at bottom left, rgba(13, 148, 136, 0.05), transparent);
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 0.8s ease-out;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-bottom: 2.5rem;
    animation: fadeInUp 1s ease-out both;
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.glass-card:hover { transform: translateY(-10px); }

.feature-tag {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 2rem;
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.section-title {
    text-align: center;
    margin: 6rem 0 4rem;
}

.section-title h2 { font-size: 2.5rem; margin-bottom: 1rem; }
.section-title p { color: var(--text-muted); max-width: 600px; margin: 0 auto; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile/Responsive Improvements */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 1rem;
    }
    .sidebar .sidebar-logo h2, 
    .sidebar .sidebar-logo p, 
    .sidebar .menu-link span, 
    .sidebar .role-badge, 
    .sidebar .user-profile p, 
    .sidebar .demo-switcher {
        display: none;
    }
    .sidebar .menu-link, .sidebar .user-profile {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        top: auto;
        flex-direction: row;
        padding: 0.5rem;
        z-index: 1000;
        justify-content: space-around;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    }
    
    .sidebar .sidebar-logo, .sidebar .demo-switcher, .sidebar .user-profile {
        display: none;
    }
    
    .sidebar .menu-list {
        display: flex;
        width: 100%;
        margin-top: 0;
        justify-content: space-around;
    }
    
    .sidebar .menu-item {
        margin-bottom: 0;
    }
    
    .sidebar .menu-link {
        flex-direction: column;
        gap: 2px;
        font-size: 0.65rem;
        padding: 0.5rem;
    }

    .main-content {
        padding: 1rem;
        margin-bottom: 60px; /* Space for bottom nav */
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header .flex:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .header input {
        flex: 1;
    }

    /* Grid Stacking */
    .stat-grid {
        grid-template-columns: 1fr;
    }

    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    .card .flex.justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Utils */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

/* Responsive Layout Utilities */
.responsive-section {
    padding: 6rem 0;
}

/* Removed duplicate landing-container */

.grid-responsive-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.grid-responsive-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-responsive-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

@media (max-width: 1024px) {
    .grid-responsive-2 {
        gap: 2rem;
    }
}

.flex-responsive {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.stats-grid-wrapper {
    max-width: 1100px; 
    margin: -4rem auto 0; 
    position: relative; 
    z-index: 10;
}

@media (max-width: 1024px) {
    .responsive-section {
        padding: 4rem 0;
    }
    .flex-responsive {
        gap: 2rem;
    }
    .grid-responsive-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-responsive-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 1.5rem;
    }
    .landing-container {
        padding: 0 var(--container-padding);
    }
    
    nav.landing-container {
        position: relative !important;
        padding: 1rem 1.25rem !important;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border);
    }

    .responsive-section {
        padding: 3rem 0;
    }
    
    .hero {
        padding: 4rem 0 6rem !important;
    }

    .landing-wrapper h1 { font-size: 2.15rem !important; }
    .landing-wrapper h2 { font-size: 1.65rem !important; }
    .landing-wrapper h3 { font-size: 1.2rem !important; }

    .stats-grid-wrapper {
        margin: 2rem auto 0;
    }

    .grid-responsive-4,
    .grid-responsive-3,
    .grid-responsive-2 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .flex-responsive {
        flex-direction: column !important;
        text-align: center;
        gap: 2.5rem;
    }
    .flex-responsive > div {
        width: 100% !important;
        flex: none !important;
    }
    .flex-responsive h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }
    .flex-responsive .btn {
        margin-left: auto;
        margin-right: auto;
    }
    .flex-responsive ul {
        display: inline-block;
        text-align: left;
    }
    .flex-responsive li {
        justify-content: flex-start;
    }
    
    /* Persona specific tweaks */
    .flex-responsive img {
        max-width: 100% !important;
        height: auto;
        margin: 0 auto;
    }

    /* Footer and Nav fixes */
    footer > div, nav.flex-wrap, .mobile-column {
        flex-direction: column !important;
        text-align: center;
        gap: 1.5rem;
    }
    footer div div.flex {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .landing-wrapper h1 { font-size: 1.85rem !important; }
    .landing-wrapper h2 { font-size: 1.5rem !important; }
    .landing-wrapper h3 { font-size: 1.15rem !important; }
    
    .glass-card {
        padding: 1.5rem !important;
    }
}
