/* ============================================
   MeetreAI - Premium Modern UI System
   Market Leader Design System v3.0
   ============================================ */

/* CSS Custom Properties - Premium Design Tokens */
:root {
    /* Primary Colors - Vibrant Gradient System */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    
    /* Accent Colors */
    --accent-cyan: #06b6d4;
    --accent-teal: #14b8a6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-violet: #8b5cf6;
    --accent-fuchsia: #d946ef;
    
    /* Dark Theme - Premium */
    --bg-primary: #0a0f1a;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;
    
    /* Border & Shadow */
    --border-subtle: rgba(148, 163, 184, 0.08);
    --border-default: rgba(148, 163, 184, 0.15);
    --border-strong: rgba(148, 163, 184, 0.25);
    
    /* Premium Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-premium: linear-gradient(135deg, #f43f5e 0%, #d946ef 50%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #f43f5e 100%);
    --gradient-subtle: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    --gradient-accent: linear-gradient(135deg, #ec4899 0%, #f97316 50%, #eab308 100%);
    --gradient-cool: linear-gradient(135deg, #3b82f6 0%, #06b6d4 50%, #10b981 100%);
    
    /* Glassmorphism */
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-blur: blur(20px);
    
    /* Shadows - Premium Elevation */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    --shadow-glow-accent: 0 0 60px rgba(6, 182, 212, 0.25);
    
    /* Animation Timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;
}

/* ============================================
   Base Resets & Typography
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Premium Background Pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(139, 92, 246, 0.1), transparent),
        radial-gradient(ellipse 50% 30% at 10% 80%, rgba(6, 182, 212, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

/* Animated Grid Background */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
    animation: gridMove 30s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* ============================================
   Application Shell Layout & Navigation
   ============================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

.app-sidebar {
    width: 280px;
    background: var(--glass-bg);
    border-right: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass-blur);
    padding: var(--space-xl) var(--space-lg);
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform 0.35s var(--ease-out-expo);
    box-shadow: var(--shadow-md);
}

.app-sidebar::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top, rgba(99, 102, 241, 0.15), transparent 60%);
    opacity: 0.8;
}

.app-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    margin-bottom: var(--space-xl);
}

.sidebar-brand .brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-text {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0 var(--space-md);
    margin-bottom: var(--space-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    position: relative;
    transition: all 0.25s var(--ease-out-expo);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateX(4px);
}

.nav-link.active {
    color: var(--primary-200);
    background: rgba(99, 102, 241, 0.18);
    box-shadow: var(--shadow-md);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.75;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--gradient-primary);
    color: #fff;
}

.sidebar-footer {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-lg);
    margin-top: var(--space-xl);
}

.user-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--gradient-premium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-plan {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: 30;
    background: var(--glass-bg);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
}

.app-sidebar.sidebar-collapsed {
    transform: translateX(-120%);
}

.app-main {
    flex: 1;
    margin-left: 280px;
    padding: var(--space-2xl);
    max-width: calc(100vw - 280px);
}

@media (max-width: 1180px) {
    .app-main {
        padding: var(--space-xl);
    }
}

@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-120%);
    }

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

    .sidebar-toggle {
        display: inline-flex;
    }

    .app-main {
        margin-left: 0;
        max-width: 100%;
    }
}

/* ============================================
   Page Header & Sections
   ============================================ */
.page-hero {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(15, 23, 42, 0.8));
    padding: var(--space-2xl);
    margin-bottom: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.page-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(6, 182, 212, 0.1), transparent 60%);
    pointer-events: none;
}

.page-hero .hero-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-cyan);
    margin-bottom: var(--space-sm);
}

.page-hero h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    margin-bottom: var(--space-md);
}

.page-hero p {
    max-width: 680px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.hero-actions {
    margin-top: var(--space-xl);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.hero-metric {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
}

.hero-metric .label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.hero-metric .value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: var(--space-sm);
}

.page-section {
    margin-bottom: var(--space-2xl);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.grid-responsive {
    display: grid;
    gap: var(--space-xl);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-mixed {
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 1200px) {
    .grid-mixed {
        grid-template-columns: 1fr;
    }
}

.surface-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.surface-card.tight {
    padding: var(--space-lg);
}

.surface-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.surface-panel + .surface-panel {
    margin-top: var(--space-xl);
}

.panel-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.panel-body {
    padding: var(--space-xl);
}

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-xl);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.activity-item:hover {
    border-color: var(--primary-400);
    transform: translateX(4px);
}

.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.activity-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: transform 0.25s var(--ease-out-expo), border-color 0.25s ease;
}

.insight-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
}

.insight-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.insight-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: var(--space-sm);
}

.chart-card .chart-container,
.surface-card .chart-container {
    position: relative;
    height: 340px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
}

.quick-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.quick-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-400);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary);
}

.pill.success { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.pill.warning { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.pill.alert { background: rgba(239, 68, 68, 0.18); color: #f87171; }

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.chip.active {
    border-color: var(--primary-500);
    color: var(--primary-100);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.list-reset {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ============================================
   Typography System
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.text-display {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-headline {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
}

.text-title {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 600;
}

.text-body {
    font-size: 1rem;
    color: var(--text-secondary);
}

.text-small {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.text-micro {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
}

/* Gradient Text */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-premium {
    background: var(--gradient-premium);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Premium Button System
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

/* Primary Button - Premium Gradient */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 0 30px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 50px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1);
}

/* Secondary Button - Glass */
.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-400);
    transform: translateY(-2px);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* Icon Button */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* Large Button */
.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.0625rem;
    border-radius: var(--radius-xl);
}

/* Small Button */
.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
}

/* Button with glow effect */
.btn-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--shadow-md), 0 0 30px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, 0.5); }
}

/* ============================================
   Premium Card System
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    backdrop-filter: var(--glass-blur);
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-default);
    box-shadow: var(--shadow-lg);
}

/* Card with Gradient Border */
.card-gradient {
    background: var(--bg-card);
    border: none;
    position: relative;
}

.card-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.card-gradient:hover::before {
    opacity: 1;
}

/* Feature Card */
.card-feature {
    padding: var(--space-2xl);
    text-align: center;
}

.card-feature .icon-wrapper {
    width: 72px;
    height: 72px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    font-size: 32px;
    box-shadow: var(--shadow-glow);
    transition: transform 0.4s var(--spring);
}

.card-feature:hover .icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

/* Stat Card */
.card-stat {
    position: relative;
    overflow: hidden;
}

.card-stat::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.card-stat.success::after { background: var(--gradient-success); }
.card-stat.warning::after { background: var(--gradient-warning); }
.card-stat.premium::after { background: var(--gradient-premium); }

/* ============================================
   Modern Input System
   ============================================ */
.input-group {
    position: relative;
    margin-bottom: var(--space-lg);
}

.input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--glass-bg);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s var(--ease-out-expo);
    backdrop-filter: var(--glass-blur);
}

.input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Select Dropdown */
select.input,
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: calc(var(--space-lg) + 20px);
}

select.input option,
select option {
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-primary);
    padding: 12px;
}

select.input option:checked,
select option:checked {
    background: var(--primary-500);
    color: white;
}

/* Input with Icon */
.input-icon {
    padding-left: 48px;
}

.input-icon-wrapper {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Floating Label */
.input-floating-label {
    position: absolute;
    left: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    transition: all 0.3s var(--ease-out-expo);
    pointer-events: none;
}

.input:focus ~ .input-floating-label,
.input:not(:placeholder-shown) ~ .input-floating-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--primary-400);
    background: var(--bg-secondary);
    padding: 0 var(--space-xs);
}

/* ============================================
   Premium Badge System
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-300);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
}

.badge-premium {
    background: var(--gradient-premium);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Animated Badge */
.badge-live {
    position: relative;
}

.badge-live::before {
    content: '';
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ============================================
   Modern Navigation
   ============================================ */
.nav-modern {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-item-modern {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
}

.nav-item-modern:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.nav-item-modern.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-300);
}

.nav-item-modern.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

/* ============================================
   Premium Animations
   ============================================ */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow-pulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
        filter: brightness(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
        filter: brightness(1.1);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Animation Classes */
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glow-pulse 2s ease-in-out infinite; }
.animate-slide-up { animation: slide-up 0.5s var(--ease-out-expo) forwards; }
.animate-slide-right { animation: slide-in-right 0.5s var(--ease-out-expo) forwards; }
.animate-fade { animation: fade-in 0.4s ease forwards; }
.animate-scale { animation: scale-in 0.4s var(--spring) forwards; }

/* Staggered Animation */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-card-hover) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* ============================================
   Utility Classes
   ============================================ */
.glass { 
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.glow { box-shadow: var(--shadow-glow); }
.glow-accent { box-shadow: var(--shadow-glow-accent); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { 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); }
/* ============================================
   Enhanced UI Components
   ============================================ */

/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-default);
}

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

.btn-ghost:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

/* Enhanced Cards */
.card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    transition: all 0.3s var(--ease-out-expo);
}

.card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-default);
}

.card-modern:hover::before {
    opacity: 1;
}

.card-modern.featured {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-error {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
}

.status-info {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* Progress Bars */
.progress-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s var(--ease-out-expo);
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s var(--ease-out-expo);
}

.scale-in {
    animation: scaleIn 0.4s var(--ease-out-expo);
}

/* Staggered animations */
.fade-in-up:nth-child(1) { animation-delay: 0.1s; }
.fade-in-up:nth-child(2) { animation-delay: 0.2s; }
.fade-in-up:nth-child(3) { animation-delay: 0.3s; }
.fade-in-up:nth-child(4) { animation-delay: 0.4s; }
.fade-in-up:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   Responsive Design - Enhanced Mobile Support
   ============================================ */

/* Tablet styles */
@media (max-width: 1024px) {
    .app-main {
        padding: var(--space-lg);
    }
    
    .page-hero {
        padding: var(--space-xl);
    }
    
    .grid-mixed {
        grid-template-columns: 1fr;
    }
    
    .insight-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 20px;
        --space-2xl: 28px;
        --space-3xl: 40px;
    }
    
    /* Body adjustments for mobile */
    body {
        font-size: 15px;
    }
    
    /* Hide on mobile, show on desktop */
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .show-mobile-flex { display: flex !important; }
    .show-mobile-inline { display: inline-flex !important; }
    
    /* Sidebar toggle - enhanced visibility */
    .sidebar-toggle {
        display: flex !important;
        position: fixed;
        top: var(--space-md);
        left: var(--space-md);
        z-index: 1001;
        background: var(--gradient-primary);
        color: white;
        border: none;
        border-radius: var(--radius-lg);
        padding: 12px 14px;
        font-size: 1.25rem;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .sidebar-toggle:active {
        transform: scale(0.95);
    }
    
    /* Sidebar - full overlay on mobile */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 1000;
        transform: translateX(-105%);
        transition: transform 0.35s var(--ease-out-expo);
        box-shadow: var(--shadow-xl);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    /* Sidebar overlay/backdrop */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }
    
    /* Main content full width on mobile */
    .app-main {
        margin-left: 0;
        max-width: 100%;
        padding: var(--space-md);
        padding-top: calc(var(--space-md) + 56px); /* Space for toggle button */
    }
    
    /* Hero section - compact on mobile */
    .page-hero {
        padding: var(--space-lg);
        margin-bottom: var(--space-lg);
        border-radius: var(--radius-xl);
    }
    
    .page-hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .page-hero p {
        font-size: 0.9rem;
    }
    
    .hero-eyebrow {
        font-size: 0.7rem;
    }
    
    /* Hero metrics - 2 columns on mobile */
    .hero-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .hero-metric {
        padding: var(--space-md);
        border-radius: var(--radius-lg);
    }
    
    .hero-metric .value {
        font-size: 1.4rem;
    }
    
    .hero-metric .label {
        font-size: 0.7rem;
    }
    
    /* Hero actions - stack vertically */
    .hero-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Insight grid - single column on mobile */
    .insight-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .insight-card {
        padding: var(--space-lg);
    }
    
    /* Quick grid - 2 columns on mobile */
    .quick-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .quick-card {
        padding: var(--space-md);
    }
    
    .quick-action-icon {
        font-size: 1.5rem;
    }
    
    .quick-action-label {
        font-size: 0.85rem;
    }
    
    /* Section headings - stack on mobile */
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .section-subtitle {
        font-size: 0.85rem;
    }
    
    /* Cards - compact on mobile */
    .surface-card,
    .surface-panel {
        border-radius: var(--radius-lg);
    }
    
    .surface-card {
        padding: var(--space-lg);
    }
    
    .panel-header,
    .panel-body {
        padding: var(--space-md);
    }
    
    /* Activity feed - compact */
    .activity-item {
        padding: var(--space-sm);
    }
    
    .activity-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .activity-title {
        font-size: 0.875rem;
    }
    
    /* Chart container - shorter on mobile */
    .chart-card .chart-container,
    .surface-card .chart-container {
        height: 220px;
    }
    
    /* Buttons - larger touch targets */
    .btn {
        min-height: 44px;
        padding: var(--space-md) var(--space-lg);
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: var(--space-sm) var(--space-md);
    }
    
    /* Toolbar chips - scrollable on mobile */
    .toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: var(--space-xs);
    }
    
    .toolbar::-webkit-scrollbar {
        display: none;
    }
    
    /* Pill and chips - larger on mobile */
    .pill, .chip {
        padding: 8px 14px;
        font-size: 0.75rem;
    }
    
    /* Sync status indicator */
    .sync-status {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }
    
    /* Navigation links - larger touch targets */
    .nav-link {
        padding: var(--space-md) var(--space-lg);
        min-height: 48px;
    }
    
    /* User card in sidebar */
    .user-card {
        padding: var(--space-md);
    }
    
    .user-avatar {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .user-name {
        font-size: 0.85rem;
    }
    
    .user-plan {
        font-size: 0.75rem;
    }
    
    /* Footer buttons in sidebar */
    .sidebar-footer .btn {
        font-size: 0.8rem !important;
        padding: 10px 12px !important;
    }
    
    /* Grid responsive fallbacks */
    .grid-responsive {
        gap: var(--space-md);
    }
    
    .grid-2,
    .grid-3,
    .grid-mixed {
        grid-template-columns: 1fr;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    :root {
        --space-md: 12px;
        --space-lg: 14px;
    }
    
    .page-hero h1 {
        font-size: 1.5rem;
    }
    
    .hero-metrics {
        grid-template-columns: 1fr;
    }
    
    .quick-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-toggle {
        padding: 10px 12px;
        font-size: 1.1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices for better performance */
    .card:hover,
    .card-modern:hover,
    .activity-item:hover,
    .insight-card:hover,
    .quick-card:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .card:active,
    .card-modern:active,
    .quick-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Larger touch targets */
    .btn,
    .nav-link,
    .chip,
    .pill {
        touch-action: manipulation;
    }
}

/* Network status indicator - mobile friendly */
.network-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.network-status.offline {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    transform: translateY(0);
}

.network-status.syncing {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    transform: translateY(0);
}

.network-status.online {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

/* Pull to refresh indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9998;
    transition: top 0.3s ease;
}

.pull-to-refresh.visible {
    top: 70px;
}

.pull-to-refresh .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-top-color: var(--primary-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Safe area support for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .sidebar-toggle {
        top: max(var(--space-md), env(safe-area-inset-top));
        left: max(var(--space-md), env(safe-area-inset-left));
    }
    
    .app-main {
        padding-top: calc(max(var(--space-md), env(safe-area-inset-top)) + 56px);
        padding-left: max(var(--space-md), env(safe-area-inset-left));
        padding-right: max(var(--space-md), env(safe-area-inset-right));
        padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
    }
    
    .network-status {
        padding-top: max(8px, env(safe-area-inset-top));
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Light Theme
   ============================================ */
.theme-light {
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(248, 250, 252, 1);
    --bg-glass: rgba(0, 0, 0, 0.02);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    
    /* Border & Shadow */
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-default: rgba(15, 23, 42, 0.15);
    --border-strong: rgba(15, 23, 42, 0.25);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --shadow-glow-accent: 0 0 60px rgba(6, 182, 212, 0.12);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(15, 23, 42, 0.08);
}
