/**
 * JavaESPORTS - Premium UX Enhancements
 * Additional improvements for a polished, professional experience
 * @version 1.0
 * @date 2025
 */

/* ============================================================================
   SMOOTH SCROLL & PAGE TRANSITIONS
   ============================================================================ */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Page fade-in animation */
body {
    animation: pageF adeIn 0.3s ease-in-out;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   ENHANCED BUTTON STATES - ALL BUTTONS
   ============================================================================ */

.btn,
button,
[role="button"] {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

/* Ripple effect on click */
.btn::after,
button::after {
    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, height 0.6s;
}

.btn:active::after,
button:active::after {
    width: 300px;
    height: 300px;
}

/* Better hover states for all interactive elements */
.btn:hover,
.card:hover,
.nav__link:hover,
.footer__nav-link:hover {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
}

/* ============================================================================
   LOADING STATES & SKELETON SCREENS
   ============================================================================ */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(139, 92, 246, 0.2) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

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

/* Skeleton screens for loading content */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(30, 27, 75, 0.5) 25%,
        rgba(139, 92, 246, 0.1) 50%,
        rgba(30, 27, 75, 0.5) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 2s ease-in-out infinite;
    border-radius: 8px;
}

[data-theme="light"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(240, 242, 255, 0.8) 25%,
        rgba(139, 92, 246, 0.15) 50%,
        rgba(240, 242, 255, 0.8) 75%
    );
}

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

/* ============================================================================
   ENHANCED FOCUS STATES - ACCESSIBILITY
   ============================================================================ */

*:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Better focus for buttons */
.btn:focus-visible,
button:focus-visible {
    outline-color: #8b5cf6;
    outline-width: 3px;
    outline-offset: 4px;
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.2);
}

/* Enhanced focus for navigation links */
.nav__link:focus-visible {
    background: rgba(139, 92, 246, 0.2);
    outline-color: #fff;
}

[data-theme="light"] .nav__link:focus-visible {
    outline-color: #1e1b4b;
}

/* ============================================================================
   IMPROVED CARD INTERACTIONS
   ============================================================================ */

.card {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
}

@media (hover: none) {
    .card:hover {
        transform: none;
    }
    
    .card:active {
        transform: scale(0.98);
    }
}

/* ============================================================================
   ENHANCED TOOLTIPS
   ============================================================================ */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 0.5rem 0.75rem;
    background: rgba(30, 27, 75, 0.95);
    color: #fff;
    font-size: 0.875rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 9999;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(30, 27, 75, 0.95);
    opacity: 0;
    transition: all 0.2s ease;
}

[data-tooltip]:hover::before,
[data-tooltip]:focus::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    opacity: 1;
}

[data-theme="light"] [data-tooltip]::before {
    background: rgba(255, 255, 255, 0.98);
    color: #1e1b4b;
    border-color: rgba(139, 92, 246, 0.25);
}

[data-theme="light"] [data-tooltip]::after {
    border-top-color: rgba(255, 255, 255, 0.98);
}

/* ============================================================================
   SCROLL PROGRESS INDICATOR
   ============================================================================ */

.scroll-progress {
    position: fixed;
    top: 70px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
    z-index: 9998;
    transition: width 0.1s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
}

/* ============================================================================
   ENHANCED IMAGE LOADING
   ============================================================================ */

img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded,
img.loaded {
    opacity: 1;
}

/* Image placeholder while loading */
img::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.1),
        rgba(124, 58, 237, 0.1)
    );
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================================================
   BETTER SELECTION HIGHLIGHTING
   ============================================================================ */

::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

::-moz-selection {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

[data-theme="light"] ::selection {
    background: rgba(139, 92, 246, 0.25);
    color: #1e1b4b;
}

[data-theme="light"] ::-moz-selection {
    background: rgba(139, 92, 246, 0.25);
    color: #1e1b4b;
}

/* ============================================================================
   ENHANCED SCROLLBAR (WEBKIT)
   ============================================================================ */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 27, 75, 0.3);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
    background-clip: padding-box;
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(240, 242, 255, 0.8);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.6);
}

/* ============================================================================
   MOBILE-SPECIFIC ENHANCEMENTS
   ============================================================================ */

@media (max-width: 767px) {
    /* Better tap feedback */
    * {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.15);
    }

    /* Optimize animations for mobile */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }

    /* Disable hover effects on mobile */
    @media (hover: none) {
        .card:hover {
            transform: none;
            box-shadow: none;
        }
        
        .btn:hover {
            box-shadow: none;
        }
    }

    /* Larger touch targets on mobile */
    .btn,
    button,
    a,
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for mobile */
    .section {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

/* ============================================================================
   PULL-TO-REFRESH OPTIMIZATION
   ============================================================================ */

@media (max-width: 767px) {
    body {
        overscroll-behavior-y: contain;
    }
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================================ */

/* Use GPU acceleration for smooth animations */
.card,
.btn,
.nav__link,
.footer__nav-link,
.hero__text {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ============================================================================
   NOTIFICATION/TOAST STYLES
   ============================================================================ */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(30, 27, 75, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9375rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(120%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10000;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
}

[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.98);
    color: #1e1b4b;
    border-color: rgba(139, 92, 246, 0.25);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
}

@media (max-width: 767px) {
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* ============================================================================
   EMPTY STATE IMPROVEMENTS
   ============================================================================ */

.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}

.empty-state__message {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

[data-theme="light"] .empty-state {
    color: rgba(30, 27, 75, 0.7);
}

[data-theme="light"] .empty-state__title {
    color: rgba(30, 27, 75, 0.9);
}

/* ============================================================================
   BADGE ENHANCEMENTS
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

[data-theme="light"] .badge {
    background: rgba(139, 92, 246, 0.15);
    color: rgba(30, 27, 75, 0.95);
}

/* ============================================================================
   PRINT OPTIMIZATIONS
   ============================================================================ */

@media print {
    /* Remove animations in print */
    * {
        animation: none !important;
        transition: none !important;
    }

    /* Hide interactive elements */
    .btn,
    button,
    .nav,
    .footer__social-links {
        display: none !important;
    }

    /* Optimize colors for print */
    body {
        background: white !important;
        color: black !important;
    }

    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}

/* ============================================================================
   END OF PREMIUM ENHANCEMENTS
   ============================================================================ */

