/* ========================================
   ADVANCED CSS TECHNIQUES & INNOVATIONS
   ======================================== */

/* CSS Custom Properties for Dynamic Theming */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #718096;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    /* Advanced color system */
    --color-primary-50: #f0f4ff;
    --color-primary-100: #e0e7ff;
    --color-primary-200: #c7d2fe;
    --color-primary-300: #a5b4fc;
    --color-primary-400: #818cf8;
    --color-primary-500: #6366f1;
    --color-primary-600: #4f46e5;
    --color-primary-700: #4338ca;
    --color-primary-800: #3730a3;
    --color-primary-900: #312e81;
    
    /* Spacing system */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Typography scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    
    /* Border radius system */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Animation timing */
    --timing-fast: 0.15s;
    --timing-normal: 0.3s;
    --timing-slow: 0.5s;
    --timing-slower: 0.75s;
    
    /* Easing functions */
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary: #818cf8;
    --secondary: #a78bfa;
    --accent: #fbbf24;
    --dark: #f7fafc;
    --light: #1a202c;
    --gray: #a0aec0;
    --white: #2d3748;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Advanced Grid Systems */
.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    padding: var(--space-xl);
}

.masonry-grid {
    column-count: 3;
    column-gap: var(--space-lg);
    break-inside: avoid;
}

@media (max-width: 768px) {
    .masonry-grid {
        column-count: 1;
    }
}

/* Glassmorphism Effects */
.glassmorphism {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.glassmorphism-dark {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Neumorphism Effects */
.neumorphism {
    background: var(--light);
    border-radius: var(--radius-xl);
    box-shadow: 
        20px 20px 60px #d1d9e6,
        -20px -20px 60px #ffffff;
    transition: all var(--timing-normal) var(--ease-in-out);
}

.neumorphism:hover {
    box-shadow: 
        inset 20px 20px 60px #d1d9e6,
        inset -20px -20px 60px #ffffff;
}

.neumorphism-dark {
    background: var(--dark);
    border-radius: var(--radius-xl);
    box-shadow: 
        20px 20px 60px #1a1a1a,
        -20px -20px 60px #2a2a2a;
    transition: all var(--timing-normal) var(--ease-in-out);
}

.neumorphism-dark:hover {
    box-shadow: 
        inset 20px 20px 60px #1a1a1a,
        inset -20px -20px 60px #2a2a2a;
}

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

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

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

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes morphing {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 50% { border-color: transparent; }
    51%, 100% { border-color: var(--primary); }
}

/* Advanced Hover Effects */
.hover-lift {
    transition: all var(--timing-normal) var(--ease-out);
}

.hover-lift:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    position: relative;
    transition: all var(--timing-normal) var(--ease-out);
}

.hover-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient);
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--timing-normal) var(--ease-out);
    z-index: -1;
}

.hover-glow:hover::before {
    opacity: 0.1;
}

.hover-rotate {
    transition: transform var(--timing-normal) var(--ease-out);
}

.hover-rotate:hover {
    transform: rotate(5deg) scale(1.05);
}

.hover-skew {
    transition: transform var(--timing-normal) var(--ease-out);
}

.hover-skew:hover {
    transform: skewX(-5deg) scale(1.02);
}

/* Advanced Text Effects */
.text-gradient {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
    background-size: 200% 200%;
    text-shadow: 
        0 0 2px rgba(255, 255, 255, 0.8),
        0 0 4px rgba(255, 255, 255, 0.6),
        0 0 6px rgba(255, 255, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.text-shimmer {
    background: linear-gradient(
        90deg,
        var(--gray) 0%,
        var(--primary) 50%,
        var(--gray) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s linear infinite;
}

.text-typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: typewriter 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Advanced Button Styles */
.btn-advanced {
    position: relative;
    overflow: hidden;
    background: var(--gradient);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--timing-normal) var(--ease-out);
}

.btn-advanced::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(--timing-slow) var(--ease-out);
}

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

.btn-advanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Morphing Shapes */
.morphing-shape {
    width: 200px;
    height: 200px;
    background: var(--gradient);
    animation: morphing 8s ease-in-out infinite;
    transition: all var(--timing-normal) var(--ease-out);
}

.morphing-shape:hover {
    animation-duration: 2s;
    transform: scale(1.1);
}

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

.loading-pulse {
    animation: pulse 2s infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Advanced Scroll Effects */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s var(--ease-out);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Advanced Form Styles */
.form-group {
    position: relative;
    margin-bottom: var(--space-lg);
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--light);
    border-radius: var(--radius-md);
    background: transparent;
    transition: all var(--timing-normal) var(--ease-out);
    font-size: var(--text-base);
}

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

.form-label {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    color: var(--gray);
    transition: all var(--timing-normal) var(--ease-out);
    pointer-events: none;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    top: -8px;
    left: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--primary);
    background: white;
    padding: 0 var(--space-xs);
}

/* Advanced Card Styles */
.card-advanced {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow);
    transition: all var(--timing-normal) var(--ease-out);
    overflow: hidden;
}

.card-advanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    transform: scaleX(0);
    transition: transform var(--timing-normal) var(--ease-out);
}

.card-advanced:hover::before {
    transform: scaleX(1);
}

.card-advanced:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Advanced Navigation */
.nav-advanced {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    transition: all var(--timing-normal) var(--ease-out);
}

.nav-advanced.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
}

/* Advanced Typography */
.typography-display {
    font-size: var(--text-5xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.typography-heading {
    font-size: var(--text-3xl);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.typography-body {
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray);
}

/* Advanced Responsive Design */
@media (max-width: 1024px) {
    .advanced-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-lg);
    }
}

@media (max-width: 768px) {
    .advanced-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .typography-display {
        font-size: var(--text-4xl);
    }
    
    .typography-heading {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 480px) {
    .typography-display {
        font-size: var(--text-3xl);
    }
    
    .typography-heading {
        font-size: var(--text-xl);
    }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --secondary: #000080;
        --dark: #000000;
        --light: #ffffff;
        --gray: #666666;
    }
}

/* Floating Action Button */
.floating-action-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--timing-normal) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.fab-toggle.active {
    transform: rotate(45deg);
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--timing-normal) var(--ease-out);
}

.fab-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all var(--timing-normal) var(--ease-out);
    font-size: 1.2rem;
}

.fab-item:hover {
    transform: scale(1.1);
    background: var(--primary);
    color: white;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--gradient);
    z-index: 1001;
    transition: width var(--timing-fast) var(--ease-out);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--timing-slow) var(--ease-out);
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h3 {
    margin-top: 2rem;
    font-size: var(--text-2xl);
}

/* Advanced Scroll Effects */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s var(--ease-out);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Interactive Background Elements */
.interactive-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: var(--gradient);
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-shape:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-shape:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.floating-shape:nth-child(3) {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

/* Advanced Typography Effects */
.text-3d {
    text-shadow: 
        1px 1px 0 #ccc,
        2px 2px 0 #c9c9c9,
        3px 3px 0 #bbb,
        4px 4px 0 #b9b9b9,
        5px 5px 0 #aaa,
        6px 6px 1px rgba(0,0,0,.1),
        0 0 5px rgba(0,0,0,.1),
        1px 1px 3px rgba(0,0,0,.3),
        3px 3px 5px rgba(0,0,0,.2),
        5px 5px 10px rgba(0,0,0,.25);
}

.text-neon {
    color: #fff;
    text-shadow:
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 15px var(--primary),
        0 0 20px var(--primary),
        0 0 35px var(--primary),
        0 0 40px var(--primary);
    animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
            0 0 5px var(--primary),
            0 0 10px var(--primary),
            0 0 15px var(--primary),
            0 0 20px var(--primary),
            0 0 35px var(--primary),
            0 0 40px var(--primary);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Advanced Card Hover Effects */
.card-tilt {
    transition: transform var(--timing-normal) var(--ease-out);
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(10deg) rotateY(10deg) scale(1.05);
}

.card-flip {
    perspective: 1000px;
    transition: transform var(--timing-normal) var(--ease-out);
}

.card-flip:hover {
    transform: rotateY(180deg);
}

/* Advanced Button Animations */
.btn-bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.btn-pulse {
    animation: pulse 2s infinite;
}

.btn-wiggle {
    animation: wiggle 1s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

/* Print styles */
@media print {
    .nav-advanced,
    .btn-advanced,
    .hover-lift,
    .hover-glow,
    .floating-action-button,
    .scroll-progress,
    .loading-screen {
        display: none !important;
    }
    
    .card-advanced {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
