/*
 * Modern Components CSS
 * Global styles for modern component library
 * Version: 1.0.0
 */

/* ===================================
   CSS Variables & Design Tokens
=================================== */
:root {
    /* Modern Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --primary-light: rgba(102, 126, 234, 0.1);
    
    /* Glass Morphism */
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-bg-alt: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --glass-backdrop-filter: blur(20px);
    
    /* Modern Spacing */
    --spacing-xs: 0.5rem;   /* 8px */
    --spacing-sm: 0.75rem;  /* 12px */
    --spacing-md: 1rem;     /* 16px */
    --spacing-lg: 1.5rem;   /* 24px */
    --spacing-xl: 2rem;     /* 32px */
    --spacing-2xl: 3rem;    /* 48px */
    --spacing-3xl: 4rem;    /* 64px */
    
    /* Border Radius */
    --radius-sm: 0.5rem;    /* 8px */
    --radius-md: 0.75rem;   /* 12px */
    --radius-lg: 1rem;      /* 16px */
    --radius-xl: 1.25rem;   /* 20px */
    --radius-2xl: 1.875rem; /* 30px */
    --radius-full: 9999px;
    
    /* Typography Scale */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */
    --text-5xl: 3rem;       /* 48px */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Animation Easing */
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Transition Durations */
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
    --duration-slower: 750ms;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(0, 0, 0, 0.25);
        --glass-bg-alt: rgba(0, 0, 0, 0.1);
        --glass-border: rgba(255, 255, 255, 0.1);
    }
}

/* ===================================
   Global Utility Classes
=================================== */

/* Glass Morphism Utilities */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop-filter);
    -webkit-backdrop-filter: var(--glass-backdrop-filter);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-effect-alt {
    background: var(--glass-bg-alt);
    backdrop-filter: var(--glass-backdrop-filter);
    -webkit-backdrop-filter: var(--glass-backdrop-filter);
    border: 1px solid var(--glass-border);
}

/* Gradient Utilities */
.gradient-primary {
    background: var(--primary-gradient);
}

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

/* Modern Card Base */
.modern-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all var(--duration-normal) var(--ease-in-out);
    overflow: hidden;
    position: relative;
}

.modern-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: var(--shadow-2xl);
}

/* Modern Button Base */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--duration-normal) var(--ease-in-out);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--duration-slow) var(--ease-in-out);
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:hover {
    transform: translateY(-0.125rem);
    text-decoration: none;
}

/* Modern Input Base */
.input-modern {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    background: white;
    transition: all var(--duration-normal) var(--ease-in-out);
    font-size: var(--text-base);
}

.input-modern:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===================================
   Animation Utilities
=================================== */

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Rotation Animations */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1rem);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-in-up {
    animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight var(--duration-slow) var(--ease-out) forwards;
}

.animate-scale-in {
    animation: scaleIn var(--duration-slow) var(--ease-out) forwards;
}

.animate-scale-in-bounce {
    animation: scaleInBounce var(--duration-slower) var(--ease-bounce) forwards;
}

.animate-rotate-in {
    animation: rotateIn var(--duration-slow) var(--ease-out) forwards;
}

.animate-float {
    animation: float 3s var(--ease-in-out) infinite;
}

.animate-pulse {
    animation: pulse 2s var(--ease-in-out) infinite;
}

/* ===================================
   Responsive Utilities
=================================== */

/* Spacing Responsive */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 1.25rem;   /* 20px */
        --spacing-2xl: 2rem;     /* 32px */
        --spacing-3xl: 2.5rem;   /* 40px */
    }
}

/* ===================================
   Component State Classes
=================================== */

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

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5rem;
    height: 1.5rem;
    margin: -0.75rem 0 0 -0.75rem;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

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

/* Error State */
.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* Success State */
.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

/* Warning State */
.warning {
    border-color: #f59e0b !important;
    background-color: #fffbeb !important;
}

/* ===================================
   Accessibility Enhancements
=================================== */

/* Focus Styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .modern-card {
        border: 2px solid currentColor;
    }
    
    .btn-modern {
        border: 2px solid currentColor;
    }
}

/* 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;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   Print Styles
=================================== */

@media print {
    .modern-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .glass-effect,
    .glass-effect-alt {
        background: white !important;
        backdrop-filter: none !important;
        border: 1px solid #ddd !important;
    }
    
    .gradient-primary,
    .gradient-text {
        background: none !important;
        color: #000 !important;
    }
}

/* ===================================
   Layout Utilities
=================================== */

/* Modern Container */
.container-modern {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

@media (max-width: 768px) {
    .container-modern {
        padding: 0 var(--spacing-md);
    }
}

/* Modern Grid */
.grid-modern {
    display: grid;
    gap: var(--spacing-lg);
}

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

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

.grid-modern--4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Modern Flex */
.flex-modern {
    display: flex;
    gap: var(--spacing-md);
}

.flex-modern--center {
    align-items: center;
    justify-content: center;
}

.flex-modern--between {
    justify-content: space-between;
    align-items: center;
}

.flex-modern--wrap {
    flex-wrap: wrap;
}