/* Performance Optimizations & SEO Enhancements CSS */
/* MDS Genie - Production Ready */
/* ================================================ */

/* ========================================
   1. Scroll Progress Bar
   ======================================== */

.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.scroll-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ========================================
   2. Toast Notifications
   ======================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 50%;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* Toast Types */
.toast-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.9));
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: white;
}

/* Toast Animations */
.fade-in-up {
    animation: fadeInUp 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
    opacity: 0;
    transform: translateY(-20px);
}

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

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

/* ========================================
   3. Loader Overlay
   ======================================== */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

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

.loader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: white;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

/* ========================================
   4. Ripple Effect for Buttons
   ======================================== */

button, .btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========================================
   5. Character Counter for Textareas
   ======================================== */

.char-counter-enhanced {
    text-align: right;
    font-size: 12px;
    margin-top: 5px;
    color: rgba(148, 163, 184, 0.8);
    transition: color 0.3s ease;
}

.char-counter-enhanced.warning {
    color: #f59e0b;
    font-weight: 500;
}

/* ========================================
   6. Input Focus Effects
   ======================================== */

.input-focused {
    position: relative;
}

.input-focused::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    animation: expand 0.3s ease;
}

@keyframes expand {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* ========================================
   7. Lazy Loading Image Fade
   ======================================== */

img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.fade-in {
    opacity: 1;
}

/* ========================================
   8. Scroll Animations
   ======================================== */

[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate-child] {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

[data-animate-child].animated {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   9. Page Load Animation
   ======================================== */

body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.page-loaded {
    opacity: 1;
}

/* ========================================
   10. Parallax Effects
   ======================================== */

[data-parallax] {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ========================================
   11. Performance Hints
   ======================================== */

/* GPU Acceleration for Animations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize for Mobile */
@media (max-width: 768px) {
    .scroll-progress-bar {
        height: 2px;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    /* Disable parallax on mobile for performance */
    [data-parallax] {
        transform: none !important;
    }
}

/* High Performance Mode */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .scroll-progress-bar {
        background: rgba(255, 255, 255, 0.1);
    }

    .char-counter-enhanced {
        color: rgba(148, 163, 184, 0.6);
    }
}