/* 
iOS-Inspired Platform Design System
Mobile-first, premium experience with Apple-quality polish
*/

/* ==========================================================================
   DESIGN SYSTEM FOUNDATION
   ========================================================================== */

/* Prevent mobile overflow */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    /* iOS Color System */
    --ios-blue: #007AFF;
    --ios-blue-dark: #0056CC;
    --ios-gray: #8E8E93;
    --ios-gray-2: #AEAEB2;
    --ios-gray-3: #C7C7CC;
    --ios-gray-4: #D1D1D6;
    --ios-gray-5: #E5E5EA;
    --ios-gray-6: #F2F2F7;
    
    /* System Colors - Apple.com inspired lighter design */
    --system-background: #FFFFFF;
    --system-background-secondary: #FBFBFD;
    --system-grouped-background: #FBFBFD;  /* Much lighter bone/grey background */
    --system-grouped-background-secondary: #FFFFFF;
    
    /* Text Colors */
    --text-primary: #000000;
    --text-secondary: #3C3C43;
    --text-tertiary: #3C3C4399;
    --text-quaternary: #3C3C432E;
    
    /* iOS Spacing System (8pt grid) */
    --space-1: 4px;   /* 0.5 units */
    --space-2: 8px;   /* 1 unit */
    --space-3: 12px;  /* 1.5 units */
    --space-4: 16px;  /* 2 units */
    --space-5: 20px;  /* 2.5 units */
    --space-6: 24px;  /* 3 units */
    --space-8: 32px;  /* 4 units */
    --space-10: 40px; /* 5 units */
    --space-12: 48px; /* 6 units */
    --space-16: 64px; /* 8 units */
    
    /* Lexy Brand Colors */
    --lexy-primary: #3498db;
    --lexy-primary-dark: #2980b9;
    --lexy-secondary: #2e4057;
    --lexy-accent: #34c759;
    --lexy-premium: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --lexy-education: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --lexy-active: linear-gradient(135deg, #FFD700, #FFA500);
    --lexy-free: var(--ios-gray-6);
    
    /* iOS Typography Scale */
    --text-large-title: 34px;
    --text-title-1: 28px;
    --text-title-2: 22px;
    --text-title-3: 20px;
    --text-headline: 17px;
    --text-body: 17px;
    --text-callout: 16px;
    --text-subheadline: 15px;
    --text-footnote: 13px;
    --text-caption-1: 12px;
    --text-caption-2: 11px;
    
    /* iOS Border Radius */
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    --radius-xlarge: 20px;
    
    /* iOS Shadows */
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.16);
    
    /* iOS Animation Curves */
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Platform-specific color variables */
    --platform-primary: var(--ios-blue);
    --platform-primary-light: #E3F2FD;
    --platform-accent: var(--ios-blue-dark);
    --platform-background: var(--system-background);
    --platform-background-subtle: var(--system-background-secondary);
    --platform-text-primary: var(--text-primary);
    --platform-text-secondary: var(--text-secondary);
    --platform-text-tertiary: var(--text-tertiary);
    --platform-border: var(--ios-gray-4);
    --platform-border-light: var(--ios-gray-5);
    
    /* Platform spacing */
    --platform-space-xs: var(--space-1);
    --platform-space-sm: var(--space-2);
    --platform-space-md: var(--space-3);
    --platform-space-lg: var(--space-4);
    --platform-space-xl: var(--space-6);
    --platform-space-2xl: var(--space-8);
    --platform-radius-sm: var(--radius-small);
    --platform-radius-md: var(--radius-medium);
    --platform-radius-lg: var(--radius-large);
    --platform-radius-xl: var(--radius-xlarge);
    --platform-shadow-sm: var(--shadow-light);
    --platform-shadow-md: var(--shadow-medium);
    --platform-shadow-lg: var(--shadow-heavy);
    
    /* Platform typography */
    --platform-text-xs: var(--text-caption-2);
    --platform-text-sm: var(--text-caption-1);
    --platform-text-base: var(--text-footnote);
    --platform-text-lg: var(--text-subheadline);
    --platform-text-xl: var(--text-callout);
    --platform-text-2xl: var(--text-headline);
    --platform-text-3xl: var(--text-title-3);
    --platform-text-4xl: var(--text-title-2);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        /* iOS Dark Mode Colors */
        --ios-blue: #0A84FF;
        --ios-blue-dark: #0A6ECC;
        --ios-gray: #8E8E93;
        --ios-gray-2: #636366;
        --ios-gray-3: #48484A;
        --ios-gray-4: #3A3A3C;
        --ios-gray-5: #2C2C2E;
        --ios-gray-6: #1C1C1E;
        
        /* System Dark Colors */
        --system-background: #000000;
        --system-background-secondary: #1C1C1E;
        --system-grouped-background: #1C1C1E;
        --system-grouped-background-secondary: #2C2C2E;
        
        /* Dark Text Colors */
        --text-primary: #FFFFFF;
        --text-secondary: #EBEBF5;
        --text-tertiary: #EBEBF599;
        --text-quaternary: #EBEBF52E;
        
        /* Update platform variables for dark mode */
        --platform-primary: var(--ios-blue);
        --platform-primary-light: #1A2332;
        --platform-accent: var(--ios-blue-dark);
        --platform-background: var(--system-background);
        --platform-background-subtle: var(--system-background-secondary);
        --platform-text-primary: var(--text-primary);
        --platform-text-secondary: var(--text-secondary);
        --platform-text-tertiary: var(--text-tertiary);
        --platform-border: var(--ios-gray-4);
        --platform-border-light: var(--ios-gray-5);
    }
}

/* ==========================================================================
   TYPOGRAPHY SYSTEM
   ========================================================================== */

.text-large-title {
    font-size: var(--text-large-title);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.022em;
    padding: var(--space-2) var(--space-4);
}

.text-title-1 {
    font-size: var(--text-title-1);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.017em;
    padding: var(--space-2) var(--space-4);
}

.text-title-2 {
    font-size: var(--text-title-2);
    font-weight: 600;
    line-height: 1.27;
    letter-spacing: -0.012em;
    padding: var(--space-2) var(--space-4);
}

.text-title-3 {
    font-size: var(--text-title-3);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.008em;
    padding: var(--space-2) var(--space-4);
}

.text-headline {
    font-size: var(--text-headline);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.005em;
    padding: var(--space-2) var(--space-4);
}

.text-body {
    font-size: var(--text-body);
    font-weight: 400;
    line-height: 1.47;
    letter-spacing: -0.005em;
    padding: var(--space-2) var(--space-4);
}

.text-callout {
    font-size: var(--text-callout);
    font-weight: 400;
    line-height: 1.4;
    padding: var(--space-2) var(--space-4);
}

.text-subheadline {
    font-size: var(--text-subheadline);
    font-weight: 400;
    line-height: 1.33;
    padding: var(--space-2) var(--space-4);
}

.text-footnote {
    font-size: var(--text-footnote);
    font-weight: 400;
    line-height: 1.38;
    padding: var(--space-1) var(--space-4);
}

.text-caption {
    font-size: var(--text-caption-1);
    font-weight: 400;
    line-height: 1.33;
    padding: var(--space-1) var(--space-4);
}

/* ==========================================================================
   IOS COMPONENT SYSTEM
   ========================================================================== */

/* iOS Card System - Flat Apple.com Design */
.ios-card {
    background: var(--system-grouped-background-secondary);
    border-radius: var(--radius-medium);
    border: none; /* Remove borders for flat look */
    box-shadow: none; /* Remove shadow for flat look */
    margin: var(--space-2) var(--space-4);
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
}

.ios-card:active {
    transform: scale(0.98);
    box-shadow: none; /* No shadow on active */
}

.ios-card-large {
    border-radius: var(--radius-large);
    margin: var(--space-4);
    border: none; /* Remove border for flat look */
    box-shadow: none; /* Remove shadow for flat look */
}

/* iOS List System */
.ios-list {
    background: var(--system-grouped-background-secondary);
    border-radius: var(--radius-medium);
    margin: var(--space-2) var(--space-4);
    overflow: hidden;
}

.ios-list-item {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 0.5px solid var(--ios-gray-5);
    background: var(--system-background);
    transition: background-color 0.15s ease-out;
}

.ios-list-item:last-child {
    border-bottom: none;
}

.ios-list-item:active {
    background-color: var(--ios-gray-6);
}

/* iOS Button System */
.ios-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-medium);
    font-size: var(--text-body);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s var(--ease-out-expo);
    border: none;
    cursor: pointer;
    min-height: 44px; /* iOS minimum touch target */
}

.ios-button-primary {
    background: var(--ios-blue);
    color: white;
}

.ios-button-primary:hover {
    background: var(--ios-blue-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.ios-button-secondary {
    background: var(--ios-gray-6);
    color: var(--ios-blue);
}

.ios-button-secondary:hover {
    background: var(--ios-gray-5);
}

/* Dark mode styles for iOS buttons */
[data-theme="dark"] .ios-button-secondary,
.dark .ios-button-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ios-blue);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .ios-button-secondary:hover,
.dark .ios-button-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Special styling for Sign Out button in dark mode */
[data-theme="dark"] .sign-out-button,
.dark .sign-out-button {
    background: rgba(255, 59, 48, 0.1) !important;
    color: #FF453A !important;
    border: 1px solid #FF453A !important;
}

[data-theme="dark"] .sign-out-button:hover,
.dark .sign-out-button:hover {
    background: rgba(255, 59, 48, 0.2) !important;
}

.ios-button-large {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-headline);
    border-radius: var(--radius-large);
    min-height: 50px;
}

/* iOS Form System */
.ios-form-group {
    margin-bottom: var(--space-6);
}

.ios-form-label {
    display: block;
    font-size: var(--text-subheadline);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-4);
}

.ios-form-input {
    width: 100%;
    padding: var(--space-4);
    margin: 0 var(--space-4);
    max-width: calc(100% - var(--space-8));
    background: var(--system-background);
    border: 1px solid var(--ios-gray-4);
    border-radius: var(--radius-medium);
    font-size: var(--text-body);
    color: var(--text-primary);
    transition: all 0.2s ease-out;
    -webkit-appearance: none;
    appearance: none;
}

.ios-form-input:focus {
    outline: none;
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* iOS Navigation - Rounded and Flat with Background Blur */
.ios-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-large);
    margin: var(--space-3) var(--space-4);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

/* Navigation button hover effects */
.ios-nav button:hover {
    transform: scale(1.05);
    transition: transform 0.15s ease;
}

/* Feature Carousel */
.feature-carousel {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-4);
    border-radius: var(--radius-large);
    overflow: visible;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.carousel-container {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-large);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-height: 200px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    width: 100%;
}

.carousel-slide {
    flex: 0 0 100%;
    min-height: 200px;
    width: 100%;
    position: relative;
}

.carousel-slide:not(.active) {
    opacity: 0.3;
    transform: scale(0.98);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.carousel-content {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-6);
    height: 100%;
    min-height: 200px;
}

.carousel-text {
    flex: 1;
}

.carousel-text h3 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0 0 var(--space-3) 0;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.carousel-text p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 var(--space-4) 0;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.carousel-features {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.feature-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-large);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.carousel-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 var(--space-4);
}

.app-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--ios-blue), #5856D6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}

.app-icon-inner {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon-inner span {
    font-size: 24px;
    font-weight: 800;
    color: white;
}

.premium-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(255, 165, 0, 0.3);
}

.classkit-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #34C759, #30D158);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.3);
}

.carousel-cta {
    display: flex;
    align-items: center;
}

.carousel-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-large);
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.carousel-button.primary {
    background: var(--ios-blue);
    color: white;
}

.carousel-button.primary:hover {
    background: #0066CC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.carousel-button.secondary {
    background: rgba(0, 122, 255, 0.1);
    color: var(--ios-blue);
}

.carousel-button.secondary:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: translateY(-1px);
}

/* Carousel Navigation - Below Content */
.carousel-nav {
    position: static;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    z-index: 100;
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.carousel-nav svg {
    display: block;
    margin: 0 auto;
    flex-shrink: 0;
}

.carousel-nav:hover {
    opacity: 1;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.carousel-nav:active {
    transform: scale(0.95);
}

.carousel-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    margin: var(--space-2) auto 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Carousel Dots - Enhanced Pills */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.carousel-dot {
    width: 32px;
    height: 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.carousel-dot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.4s ease;
}

.carousel-dot:hover::before {
    left: 100%;
}

.carousel-dot.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Slide-specific styling - Enhanced Gradients */
.lexy-slide {
    background: linear-gradient(135deg, #007AFF 0%, #1e3a8a 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.4);
}

.premium-slide {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.4);
}

.classkit-slide {
    background: linear-gradient(135deg, #34C759 0%, #228B22 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(52, 199, 89, 0.4);
}

/* Carousel slide-specific button styling */
.lexy-slide .carousel-button.primary {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.premium-slide .carousel-button.primary {
    background: rgba(139, 69, 19, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.classkit-slide .carousel-button.primary {
    background: rgba(34, 139, 34, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

/* Carousel slide-specific button hover states */
.lexy-slide .carousel-button.primary:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.premium-slide .carousel-button.primary:hover {
    background: #8B4513;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.4);
}

.classkit-slide .carousel-button.primary:hover {
    background: #228B22;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 139, 34, 0.4);
}

/* Dark mode carousel */
@media (prefers-color-scheme: dark) {
    .carousel-container {
        background: rgba(28, 28, 30, 0.85);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .carousel-nav {
        background: rgba(28, 28, 30, 0.9);
        color: var(--text-primary);
    }
    
    .carousel-nav:hover {
        background: rgba(44, 44, 46, 1);
    }
    
    .feature-tag {
        background: rgba(0, 122, 255, 0.2);
    }
    
    .carousel-dot {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .carousel-dot.active {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    .carousel-dot:hover {
        background: rgba(255, 255, 255, 0.25);
        box-shadow: 0 6px 12px rgba(255, 255, 255, 0.08);
    }
}

/* Mobile responsive carousel */
@media (max-width: 768px) {
    .feature-carousel {
        margin: 0 auto;
        padding: 0 var(--space-2);
        max-width: 100%;
        width: 100%;
    }
    
    .carousel-container {
        max-width: 100%;
        overflow: hidden;
    }
    
    .carousel-content {
        grid-template-columns: 1fr;
        gap: var(--space-4);
        padding: var(--space-4) var(--space-3);
        text-align: center;
        min-height: 240px;
    }
    
    .carousel-text h3 {
        font-size: 20px;
    }
    
    .carousel-text p {
        font-size: 14px;
    }
    
    .carousel-visual {
        margin: 0;
        order: -1;
    }
    
    .app-icon,
    .premium-icon,
    .classkit-icon {
        width: 60px;
        height: 60px;
    }
    
    .app-icon-inner {
        width: 40px;
        height: 40px;
    }
    
    .app-icon-inner span {
        font-size: 18px;
    }
    
    .premium-icon svg,
    .classkit-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .carousel-button {
        font-size: 15px;
        padding: var(--space-3) var(--space-4);
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
    }
    
    .carousel-nav {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        flex-shrink: 0;
    }
    
    .carousel-nav svg {
        width: 24px;
        height: 24px;
    }
    
    .carousel-controls {
        padding: var(--space-4);
        gap: var(--space-4);
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        max-width: 100%;
        width: 100%;
        margin: var(--space-2) auto 0;
        box-sizing: border-box;
    }
    
    .carousel-dots {
        margin: 0 var(--space-2);
        flex-shrink: 0;
        min-width: 60px;
        justify-content: center;
    }
    
    .carousel-dot {
        width: 24px;
        height: 10px;
        min-width: 10px;
        min-height: 10px;
    }
    
    .feature-tag {
        font-size: 12px;
        padding: 4px var(--space-2);
    }
}

/* Extra small mobile screens - ensure maximum button accessibility */
@media (max-width: 480px) {
    .feature-carousel {
        margin: 0 auto;
        padding: 0 var(--space-1);
        max-width: 100%;
        width: 100%;
    }
    
    .carousel-content {
        padding: var(--space-3) var(--space-2);
    }
    
    .carousel-nav {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
    }
    
    .carousel-nav svg {
        width: 28px;
        height: 28px;
    }
    
    .carousel-controls {
        padding: var(--space-4) var(--space-2);
        gap: var(--space-3);
        width: 100%;
        margin: var(--space-2) auto 0;
        box-sizing: border-box;
        justify-content: center;
        align-items: center;
    }
    
    /* Mobile carousel layout improvements */
    .carousel-content {
        grid-template-columns: 1fr;
        gap: var(--space-4);
        text-align: center;
        padding: var(--space-4) var(--space-3);
    }
    
    .carousel-cta {
        justify-content: flex-end;
        margin-top: var(--space-4);
    }
    
    .carousel-visual {
        order: -1;
        margin: 0 auto var(--space-4) auto;
    }
    
    .carousel-button {
        font-size: 16px;
        padding: var(--space-4) var(--space-5);
        min-height: 52px;
        border-radius: var(--radius-medium);
    }
    
    .carousel-dot {
        width: 28px;
        height: 10px;
        min-width: 12px;
        min-height: 12px;
    }
}

/* Dark mode nav styling */
@media (prefers-color-scheme: dark) {
    .ios-nav {
        background: rgba(28, 28, 30, 0.85);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
    }
}

/* iOS Stats Cards */
.ios-stats-grid {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: var(--space-4);
    padding: var(--space-4);
    flex-wrap: wrap;
}

.ios-stat-card {
    background: var(--system-background);
    border-radius: var(--radius-large);
    padding: var(--space-6);
    text-align: center;
    border: none; /* Remove border for flat look */
    box-shadow: none; /* Remove shadow for flat look */
    transition: all 0.3s var(--ease-out-expo);
    flex: 1 1 160px;
    min-width: 160px;
    max-width: 200px;
}

.ios-stat-card:active {
    transform: scale(0.96);
    box-shadow: none; /* No shadow on active */
}

.ios-stat-value {
    font-size: var(--text-title-1);
    font-weight: 700;
    color: var(--ios-blue);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.ios-stat-label {
    font-size: var(--text-footnote);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Small stat cards for inline use - Flat Design */
.ios-stat-card-small {
    background: var(--ios-gray-6);
    border-radius: var(--radius-medium);
    padding: var(--space-3);
    text-align: center;
    border: none; /* Remove border for flat look */
    box-shadow: none; /* Remove shadow for flat look */
    transition: all 0.2s var(--ease-out-expo);
}

.ios-stat-card-small:hover {
    background: var(--ios-gray-5);
}

.ios-stat-value-small {
    font-size: var(--text-headline);
    font-weight: 700;
    color: var(--ios-blue);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.ios-stat-label-small {
    font-size: var(--text-caption-1);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   MOBILE-FIRST RESPONSIVE SYSTEM
   ========================================================================== */

/* ==========================================================================
   LEGACY CONTAINER SYSTEM - Being phased out for new unified system
   ========================================================================== */

/* Base mobile styles (320px+) - Legacy container */
.container {
    width: 100%;
    padding: var(--space-4);
    margin: 0 auto;
    max-width: 1200px; /* Increased from no max-width for better desktop experience */
}

/* iPhone SE and larger (375px+) */
@media (min-width: 375px) {
    .container {
        padding: var(--space-5);
    }
}

/* Large phones and small tablets (414px+) */
@media (min-width: 480px) {
    .container {
        padding: var(--space-6);
    }
    
    .ios-stats-grid {
        gap: var(--space-3);
        padding: var(--space-3);
    }
    
    .ios-stat-card {
        flex: 1 1 140px;
        min-width: 140px;
        max-width: none;
    }
}

/* Tablets and larger (768px+) */
@media (min-width: 768px) {
    .container {
        max-width: 900px; /* Increased from 768px for better tablet experience */
        padding: var(--space-8);
    }
    
    .ios-stats-grid {
        gap: var(--space-4);
        padding: var(--space-4);
    }
    
    .ios-stat-card {
        flex: 1 1 160px;
        min-width: 160px;
        max-width: 200px;
    }
    
    .ios-card {
        margin: var(--space-4) var(--space-6);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 1280px; /* Increased from 1024px for modern screens */
        padding: var(--space-8) var(--space-12);
    }
    
    .ios-nav {
        padding: var(--space-6) var(--space-8);
    }
}

/* Large desktop (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
}

/* ==========================================================================
   IOS 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);
    }
}

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

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

/* ==========================================================================
   ACCESSIBILITY & DARK MODE SUPPORT
   ========================================================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .ios-card {
        border: 2px solid var(--text-primary);
    }
    
    .ios-button-primary {
        border: 2px solid var(--text-primary);
    }
}

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

/* iOS Quick Action Buttons */
.ios-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    background: var(--ios-gray-6);
    border: 1px solid var(--ios-gray-5);
    border-radius: var(--radius-medium);
    font-size: var(--text-footnote);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out-expo);
    gap: var(--space-1);
    min-height: 64px;
}

.ios-quick-action:hover {
    background: var(--ios-gray-5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.ios-quick-action:active {
    transform: translateY(0);
    background: var(--ios-gray-4);
}

.ios-quick-action span {
    text-align: center;
    line-height: 1.2;
}

/* iOS Checkbox Styling */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    max-width: 22px; /* Prevent horizontal stretching */
    max-height: 22px; /* Prevent vertical stretching */
    background: var(--system-grouped-background-secondary);
    border: 2px solid var(--ios-gray-3);
    border-radius: var(--radius-small);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: center; /* Prevent vertical stretching in flex containers */
    box-sizing: border-box; /* Ensure consistent sizing */
}

input[type="checkbox"]:checked {
    background: var(--ios-blue);
    border-color: var(--ios-blue);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: var(--ios-blue);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* Checkbox Labels */
label[for*="checkbox"] {
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

/* Enhanced User Avatar Styling */
.user-avatar-container {
    position: relative;
    margin-right: var(--space-3);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--ios-blue), #5856D6);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: all 0.3s var(--ease-out-expo);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.user-avatar::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, var(--ios-blue), #5856D6, #FF9500);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.8;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.user-avatar.has-image {
    background: white;
    border: 2px solid var(--ios-gray-5);
}

.user-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
    flex-shrink: 0;
    /* Prevent distortion on smaller screens */
    aspect-ratio: 1/1;
    min-width: 0;
    min-height: 0;
}

.user-avatar-initials {
    color: white;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --system-background: #000000;
        --system-background-secondary: #1C1C1E;
        --system-grouped-background: #000000;
        --system-grouped-background-secondary: #1C1C1E;
        
        --text-primary: #FFFFFF;
        --text-secondary: #EBEBF5;
        --text-tertiary: #EBEBF599;
        --text-quaternary: #EBEBF52E;
        
        --ios-gray-6: #1C1C1E;
        --ios-gray-5: #2C2C2E;
        --ios-gray-4: #3A3A3C;
        --ios-gray-3: #48484A;
        --ios-gray-2: #636366;
    }
    
    /* Enhanced checkbox visibility in dark mode */
    input[type="checkbox"] {
        background: var(--ios-gray-5);
        border-color: var(--ios-gray-3);
    }
    
    input[type="checkbox"]:hover {
        border-color: var(--ios-blue);
        background: var(--ios-gray-4);
    }
    
    /* Quick action buttons in dark mode */
    .ios-quick-action {
        background: var(--ios-gray-5);
        border-color: var(--ios-gray-4);
    }
    
    .ios-quick-action:hover {
        background: var(--ios-gray-4);
        border-color: var(--ios-gray-3);
    }
}

/* ==========================================================================
   FOOTER SPACING - PREVENT OVERLAY ISSUES
   ========================================================================== */

/* Ensure main content has space for footer */
main {
    padding-bottom: 200px; /* Space for footer */
}

/* Dashboard containers need extra space */
.dashboard-container {
    padding-bottom: var(--space-20) !important;
}

/* Add space for authenticated pages with footer */
body:has(.ios-footer) main {
    padding-bottom: 220px;
}

/* Specific page containers that may have footer issues */
.container {
    margin-bottom: var(--space-8);
}

/* ==========================================================================
   MOBILE OPTIMIZATIONS
   ========================================================================== */

@media (max-width: 768px) {
    /* Optimize spacing for mobile - NO MORE PADDING: 0! */
    .container {
        padding: var(--space-3) !important; /* Keep some padding for readability */
        max-width: 100% !important;
    }
    
    /* Dashboard cards full width on mobile without padding */
    .ios-card, .ios-card-large {
        margin: var(--space-2) 0 !important; /* Remove horizontal margins */
        border-radius: 0 !important; /* Remove border radius for full width */
        box-shadow: none !important; /* Remove shadow for cleaner look */
        border-top: 1px solid var(--ios-gray-5) !important; /* Add subtle separator */
        border-bottom: 1px solid var(--ios-gray-5) !important;
    }
    
    /* First card should not have top border */
    .ios-card:first-child, .ios-card-large:first-child {
        border-top: none !important;
    }
    
    /* Last card should not have bottom border */
    .ios-card:last-child, .ios-card-large:last-child {
        border-bottom: none !important;
    }
    
    /* Stats cards should remain as cards but with minimal margins */
    .ios-stat-card {
        margin: var(--space-1) var(--space-2) !important;
        border-radius: var(--radius-medium) !important; /* Keep rounded corners for stats */
    }
    
    /* Small stat cards for student directory - ensure they fit horizontally */
    .ios-stat-card-small {
        padding: var(--space-2) var(--space-1) !important; /* Reduce padding for mobile */
        min-width: 0 !important; /* Allow shrinking */
    }
    
    .ios-stat-value-small {
        font-size: var(--text-subheadline) !important; /* Slightly smaller font */
    }
    
    .ios-stat-label-small {
        font-size: 10px !important; /* Smaller label text */
    }
    
    /* Fix navigation overflow */
    .ios-nav {
        margin: var(--space-2) var(--space-3);
        padding: var(--space-3) var(--space-3) !important;
        border-radius: var(--radius-medium);
        min-height: 56px;
    }
    
    /* Improved mobile nav title layout */
    .nav-title-section {
        gap: var(--space-2) !important;
    }
    
    .nav-title-content .text-headline {
        font-size: 20px !important;
        line-height: 1.2 !important;
    }
    
    .nav-title-content .text-caption {
        font-size: 13px !important;
        margin-top: 2px !important;
    }
    
    /* Optimize stat grid for mobile */
    .ios-stats-grid {
        gap: var(--space-2) !important;
        padding: var(--space-2) !important;
        /* Use flexbox for centered layout */
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .ios-stat-card {
        flex: 1 1 75px !important;
        min-width: 75px !important;
        max-width: 90px !important;
        padding: var(--space-2) !important;
    }
    
    /* School Management - Make stats horizontal scroll on mobile */
    .school-stats-horizontal {
        display: flex !important;
        overflow-x: auto !important;
        gap: var(--space-3) !important;
        padding: var(--space-3) !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .school-stats-horizontal .ios-stat-card-small {
        min-width: 80px !important;
        flex-shrink: 0 !important;
        scroll-snap-align: start;
    }
    
    /* Better spacing for school management cards on mobile */
    .school-card-mobile {
        margin: var(--space-2) calc(-1 * var(--space-3)) !important;
        border-radius: 0 !important;
        border-top: 1px solid var(--ios-gray-5) !important;
        border-bottom: 1px solid var(--ios-gray-5) !important;
        box-shadow: none !important;
    }
    
    .school-card-mobile:first-child {
        border-top: none !important;
        margin-top: 0 !important;
    }
    
    .school-card-mobile:last-child {
        border-bottom: none !important;
    }
    
    /* Reduce list padding on mobile */
    .ios-list-item {
        padding: var(--space-3) !important;
    }
    
    /* Fix modal sizing on mobile */
    .modal, .ios-modal {
        max-width: calc(100vw - var(--space-4)) !important;
        margin: var(--space-2) !important;
    }
    
    /* QR code modal specific fix */
    .qr-modal {
        max-width: 90vw !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    /* Mobile styles for user avatar and membership badge */
    .user-avatar-container {
        margin-right: var(--space-2) !important;
    }
    
    .user-avatar-container .user-avatar {
        width: 40px !important;
        height: 40px !important;
        font-size: 14px !important;
    }
    
    /* Adjust membership badge size on mobile */
    .user-avatar-container div[style*="background: linear-gradient"] {
        padding: 2px 6px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
    }
    
    /* Make school stats horizontal on mobile */
    .school-stats-list {
        display: flex !important;
        flex-direction: row !important;
        gap: var(--space-2) !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .school-stats-list .ios-list-item {
        flex: 0 0 auto !important;
        min-width: 200px !important;
        margin-bottom: 0 !important;
        border-radius: var(--radius-medium) !important;
        background: var(--ios-gray-6) !important;
        padding: var(--space-3) !important;
    }
    
    .qr-modal img {
        max-width: 200px !important;
        height: auto !important;
    }
    
    /* Mobile footer spacing - more space needed */
    main {
        padding-bottom: 250px; /* Reduced space since mobile footer is more compact */
    }
    
    body:has(.ios-footer) main {
        padding-bottom: 270px;
    }
    
    /* Footer mobile/desktop visibility control */
    .footer-mobile-only {
        display: block !important; /* Show mobile footer on mobile */
    }
    
    .footer-desktop-only {
        display: none !important; /* Hide desktop footer on mobile */
    }
    
    /* Mobile footer optimization */
    .ios-footer {
        padding: var(--space-4) 0 !important; /* Reduce vertical padding on mobile */
    }
    
    .ios-footer .container {
        padding: var(--space-4) var(--space-3) !important; /* Tighter horizontal padding */
    }
    
    /* Mobile footer bottom bar - stack vertically */
    .ios-footer .container > div:last-child > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: var(--space-2) !important;
    }
}

/* ==========================================================================
   PREMIUM TOUCHES
   ========================================================================== */

/* Subtle gradients for premium feel */
.premium-surface {
    background: linear-gradient(145deg, #FFFFFF 0%, #FAFAFA 100%);
}

/* Elegant separator lines */
.ios-separator {
    height: 0.5px;
    background: var(--ios-gray-5);
    margin: 0 var(--space-4);
}

/* Premium loading state */
.ios-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ios-gray-5);
    border-radius: 50%;
    border-top-color: var(--ios-blue);
    animation: spin 1s ease-in-out infinite;
}

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

/* ==========================================================================
   MODERN NAVIGATION LAYOUT
   ========================================================================== */

.nav-title-section {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

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

.membership-badge-container {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .nav-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
}

/* ==========================================================================
   MODERN LEXY MEMBERSHIP BADGES
   ========================================================================== */

.lexy-membership-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.lexy-membership-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lexy-membership-badge:hover::before {
    opacity: 1;
}

.lexy-membership-badge span {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* Branded Blue Style for All Premium Types */
.lexy-branded {
    background: linear-gradient(135deg, var(--lexy-primary) 0%, #2980b9 100%);
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.25);
}

.lexy-branded:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.35);
}

/* Upgrade Button Style */
.lexy-upgrade {
    background: rgba(0, 0, 0, 0.05);
    border: 1.5px solid var(--lexy-primary);
    cursor: pointer;
    position: relative;
}

.lexy-upgrade span {
    background: linear-gradient(135deg, var(--lexy-primary) 0%, #2980b9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-weight: 800;
    position: relative;
}

/* Add subtle pulse animation for upgrade button */
@keyframes pulse-upgrade {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
    }
    70% { 
        box-shadow: 0 0 0 4px rgba(52, 152, 219, 0);
    }
}

.lexy-upgrade {
    animation: pulse-upgrade 3s infinite;
}

.lexy-upgrade:hover {
    background: rgba(52, 152, 219, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

/* Mobile optimizations for badges */
@media (max-width: 640px) {
    .lexy-membership-badge {
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lexy-upgrade {
        background: rgba(255, 255, 255, 0.08);
    }
    
    .lexy-upgrade:hover {
        background: rgba(52, 152, 219, 0.15);
    }
}

/* ==========================================================================
   PARTICLE SYSTEM
   ========================================================================== */

.particle-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* Reduce particle intensity on mobile for performance */
@media (max-width: 768px) {
    .particle-background {
        opacity: 0.5;
    }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .particle-background {
        display: none;
    }
}

/* Dark mode particle adjustments */
@media (prefers-color-scheme: dark) {
    .particle-background {
        opacity: 0.4;
        mix-blend-mode: screen;
    }
}

/* Ensure content appears above particles */
.dashboard-main-container {
    position: relative;
    z-index: 1;
}

.analytics-container {
    position: relative;
    z-index: 1;
}

.platform-form {
    position: relative;
    z-index: 1;
}

/* Analytics Time Range Segmented Filter */
.analytics-time-filter {
    display: flex;
    background: var(--platform-surface-elevated);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--platform-border);
    max-width: fit-content;
}

.analytics-time-option {
    position: relative;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--platform-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.analytics-time-option:hover {
    background: var(--platform-background-subtle);
    color: var(--platform-text-primary);
}

.analytics-time-option.active {
    background: var(--platform-primary);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.analytics-time-option svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 640px) {
    .analytics-time-filter {
        padding: 3px;
        gap: 2px;
    }
    
    .analytics-time-option {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .analytics-time-option svg {
        width: 14px;
        height: 14px;
    }
}

/* Enhanced Level Progress Styles */
.level-progress-container {
    position: relative;
    overflow: hidden;
}

.level-badge {
    background: linear-gradient(135deg, var(--platform-primary), var(--platform-primary-dark));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.xp-progress-bar {
    position: relative;
    height: 12px;
    background: var(--platform-background-subtle);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.xp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.milestone-marker {
    position: absolute;
    top: -2px;
    width: 16px;
    height: 16px;
    background: var(--platform-surface);
    border: 2px solid var(--platform-border);
    border-radius: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.milestone-marker.reached {
    background: var(--platform-success);
    border-color: var(--platform-success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.age-ranking-badge {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.reward-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--platform-surface-elevated);
    border: 1px solid var(--platform-border);
    border-radius: 12px;
    margin-top: 12px;
}

.reward-preview img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.achievement-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.achievement-badge {
    background: var(--platform-surface-elevated);
    border: 1px solid var(--platform-border);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--platform-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.achievement-badge.recent {
    background: var(--platform-success-light);
    border-color: var(--platform-success);
    color: var(--platform-success);
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .particle-background {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: pixelated;
    }
}