/* Modern UI Theme - https://www.realtimecolors.com/ */
:root {
    /* Primary Colors - Vibrant Blue Gradient Base */
    --text: #1a1f35;
    --background: #f8fafc;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #6366f1;
    --accent: #8b5cf6;

    /* Text Colors */
    --text-50: #f8fafc;
    --text-100: #f1f5f9;
    --text-200: #e2e8f0;
    --text-300: #cbd5e1;
    --text-400: #94a3b8;
    --text-500: #64748b;
    --text-600: #475569;
    --text-700: #334155;
    --text-800: #1e293b;
    --text-900: #0f172a;

    /* Background Colors */
    --background-50: #fafafa;
    --background-100: #f4f4f5;
    --background-200: #e4e4e7;
    --background-300: #d4d4d8;
    --background-400: #a1a1aa;
    --background-500: #71717a;
    --background-600: #52525b;
    --background-700: #3f3f46;
    --background-800: #27272a;
    --background-900: #18181b;

    /* Primary Gradient Colors */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Secondary Gradient Colors */
    --secondary-50: #fdf4ff;
    --secondary-100: #fae8ff;
    --secondary-200: #f5d0fe;
    --secondary-300: #f0abfc;
    --secondary-400: #e879f9;
    --secondary-500: #c026d3;
    --secondary-600: #a21caf;
    --secondary-700: #86198f;
    --secondary-800: #701a75;
    --secondary-900: #58145c;

    /* Accent Gradient Colors */
    --accent-50: #fdf4ff;
    --accent-100: #fae8ff;
    --accent-200: #f5d0fe;
    --accent-300: #f0abfc;
    --accent-400: #e879f9;
    --accent-500: #d946ef;
    --accent-600: #c026d3;
    --accent-700: #a21caf;
    --accent-800: #86198f;
    --accent-900: #701a75;

    /* Additional UI Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Shadow Variables */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Gradient Utilities */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
}

.gradient-hero {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
}

/* Enhanced Card Styles */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

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

.card-elevated {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--primary-100);
}

.card-elevated:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-6px);
    border-color: var(--primary-200);
}

/* Enhanced Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.btn:hover::after {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--primary-600);
    border: 2px solid var(--primary-200);
}

.btn-secondary:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

.btn-glow {
    position: relative;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    color: white;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

.btn-glow:hover {
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.6), 0 0 60px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

/* Enhanced Form Inputs */
.input-enhanced {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--text-200);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.input-enhanced:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: white;
}

.input-enhanced:hover {
    border-color: var(--primary-300);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

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

@keyframes pulse-soft {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-pulse-soft {
    animation: pulse-soft 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Stagger animation delays */
.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; }

/* Stats Card Enhancements */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--text-100);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Gradient Border */
.gradient-border {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-xl) + 2px);
    background: linear-gradient(135deg, var(--primary-400), var(--secondary-400), var(--accent-400));
    z-index: -1;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Section Headers */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-800);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--secondary-500));
    border-radius: 2px;
}

.section-title-center::after {
    left: 50%;
    transform: translateX(-50%);
}

/* Enhanced Navigation Bar Styling */
.nav-enhanced {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.nav-enhanced.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-link {
    position: relative;
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: var(--text-700);
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
}

.nav-link:hover {
    color: var(--primary-600);
    background: rgba(37, 99, 235, 0.05);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-500), var(--secondary-500));
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link.active {
    color: var(--primary-600);
    background: rgba(37, 99, 235, 0.1);
}

.nav-link.active::after {
    width: 80%;
}

/* Mobile Menu Enhancement */
.mobile-menu {
    background: white;
    border-top: 1px solid var(--text-200);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-link {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.mobile-nav-link:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-600);
}

/* Logo Enhancement */
.logo-text {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.logo-text:hover {
    opacity: 0.9;
}

/* Auth Button Styling */
.auth-btn {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

.auth-btn-secondary {
    background: transparent;
    color: var(--text-700);
    border-color: var(--text-200);
}

.auth-btn-secondary:hover {
    background: var(--text-50);
    color: var(--primary-600);
    border-color: var(--primary-300);
}

/* Language Switcher */
.lang-switcher {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    color: var(--text-600);
}

.lang-switcher:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-600);
}

/* Loading State Animations */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--text-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-lg {
    width: 40px;
    height: 40px;
    border: 4px solid var(--text-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--text-100) 25%, var(--text-200) 50%, var(--text-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text-sm {
    height: 0.75em;
    width: 60%;
}

.skeleton-text-lg {
    height: 1.5em;
    width: 80%;
}

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

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

/* Pulse Loading Animation */
.pulse-loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading.btn-secondary::after {
    border-color: rgba(59, 130, 246, 0.3);
    border-top-color: var(--primary-500);
}

/* Enhanced Button Hover States */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-hover-lift:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-hover-scale {
    transition: transform 0.2s ease;
}

.btn-hover-scale:hover {
    transform: scale(1.05);
}

.btn-hover-scale:active {
    transform: scale(0.98);
}

.btn-hover-glow {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-hover-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-hover-glow:hover::before {
    width: 300px;
    height: 300px;
}

.btn-hover-ripple {
    position: relative;
    overflow: hidden;
}

.btn-hover-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn-hover-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Focus States for Accessibility */
.btn-focus-visible:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.btn-focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Disabled State */
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive Design Improvements */
@media (max-width: 768px) {
    .card {
        border-radius: var(--radius-md);
    }

    .card-elevated {
        border-radius: var(--radius-md);
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .auth-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 640px) {
    .card {
        border-radius: var(--radius-sm);
    }

    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    /* Mobile-first navigation improvements */
    .nav-enhanced {
        padding: 0.5rem 0;
    }

    .nav-enhanced .max-w-7xl {
        padding: 0 1rem;
    }

    /* Touch-friendly targets */
    .nav-link,
    .mobile-nav-link,
    .auth-btn,
    .lang-switcher {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Dialog responsive */
    .dialog {
        width: 95vw;
        max-height: 90vh;
        margin: 1rem;
    }

    .dialog-header,
    .dialog-body {
        padding: 1rem;
    }

    /* Progress bar responsive */
    #download-progress {
        padding: 1rem;
    }

    #download-progress .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .card {
        padding: 1.25rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
    }
}

/* High DPI/Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .loading-spinner,
    .loading-spinner-sm,
    .loading-spinner-lg {
        border-width: 1px;
    }
}

/* Dark mode support preparation */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #f8fafc;
        --background: #0f172a;
        --text-100: #1e293b;
        --text-200: #334155;
        --text-300: #475569;
        --text-400: #64748b;
        --text-500: #94a3b8;
        --text-600: #cbd5e1;
        --text-700: #e2e8f0;
        --text-800: #f1f5f9;
        --text-900: #f8fafc;
    }
}

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

    .btn-hover-lift:hover,
    .btn-hover-scale:hover,
    .btn-hover-glow:hover {
        transform: none;
    }

    .card:hover,
    .card-elevated:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .nav-enhanced,
    #download-progress,
    .dialog,
    .btn {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    body {
        background: white;
        color: black;
    }
}