@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* Google Fonts - Elegant typography with Cormorant Garamond for refined headers */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

/* Base styles */
html, body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background-color: #faf9f6;
    color: #1e1b2e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
}

h1:focus {
    outline: none;
}

/* Links and buttons */
a, .btn-link {
    color: #4F2684;
    transition: color 0.2s ease;
}

a:hover, .btn-link:hover {
    color: #6b3fa0;
}

.btn-primary {
    color: #faf9f6;
    background: linear-gradient(135deg, #4F2684 0%, #3a1d63 100%);
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6b3fa0 0%, #4F2684 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79, 38, 132, 0.4);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(203, 182, 119, 0.5);
    border-color: #cbb677;
}

.content {
    padding: 0;
}

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid #4a9970;
    outline-offset: 1px;
}

.invalid {
    outline: 2px solid #8b2942;
    outline-offset: 1px;
}

.validation-message {
    color: #8b2942;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Error UI */
#blazor-error-ui {
    background: linear-gradient(135deg, #8b2942 0%, #6d1f33 100%);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(139, 41, 66, 0.3);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #faf9f6;
    font-family: 'DM Sans', sans-serif;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: linear-gradient(135deg, #8b2942 0%, #6d1f33 100%);
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    color: #faf9f6;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
    font-family: 'DM Sans', sans-serif;
}

/* Loading animation */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #f5f1e8;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #4F2684;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.1s ease-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: #4F2684;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* Custom animations */
@keyframes highlightCorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Legacy font support */
@font-face {
    font-family: 'Impact';
    src: url('./fonts/impact.ttf') format('truetype');
    font-weight: normal;
    font-stretch: expanded;
}

/* Progress bar smooth transition */
.progress-bar-smooth {
    transition: width 0.1s linear;
}

/* Timer warning pulse */
.timer-warning {
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Image fade-in effect */
.image-fade-in {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.image-fade-in.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Score counter animation */
.score-counter {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Leaderboard row hover effect */
.leaderboard-row {
    transition: all 0.2s ease;
}

.leaderboard-row:hover {
    transform: translateX(4px);
}

/* Card hover animations */
.animate-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.animate-card:hover {
    transform: translateY(-2px);
}

/* Button ripple effect */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::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.4s ease, height 0.4s ease;
}

.ripple-effect:active::after {
    width: 200%;
    height: 200%;
}

/* Staggered animation delays */
.animate-bounce-in-delay-1 { animation-delay: 0.1s; }
.animate-bounce-in-delay-2 { animation-delay: 0.2s; }
.animate-bounce-in-delay-3 { animation-delay: 0.3s; }
.animate-bounce-in-delay-4 { animation-delay: 0.4s; }

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f1e8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #cbb677 0%, #a8965f 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #d4c48a 0%, #cbb677 100%);
}

/* Selection styling */
::selection {
    background: rgba(79, 38, 132, 0.2);
    color: #1e1b2e;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid #cbb677;
    outline-offset: 2px;
}

/* ===== PREMIUM GLASS CARD EFFECTS ===== */

/* Glass card - light variant */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Glass card - dark variant for main cards */
.glass-card-dark {
    background: linear-gradient(
        135deg,
        rgba(26, 22, 37, 0.95) 0%,
        rgba(13, 12, 18, 0.98) 100%
    );
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

/* Game card with premium glassmorphism */
.game-card {
    background: linear-gradient(
        145deg,
        rgba(45, 31, 71, 0.6) 0%,
        rgba(26, 22, 37, 0.8) 50%,
        rgba(13, 12, 18, 0.95) 100%
    );
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(203, 182, 119, 0.03) 0%,
        transparent 50%,
        rgba(79, 38, 132, 0.02) 100%
    );
    pointer-events: none;
}

/* ===== FLOATING PARTICLE ANIMATION ===== */

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(203, 182, 119, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: float-particle 15s ease-in-out infinite;
}

.particle-1 {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.particle-2 {
    left: 25%;
    top: 60%;
    width: 3px;
    height: 3px;
    animation-delay: -3s;
    animation-duration: 22s;
}

.particle-3 {
    left: 70%;
    top: 15%;
    width: 5px;
    height: 5px;
    animation-delay: -7s;
    animation-duration: 20s;
}

.particle-4 {
    left: 85%;
    top: 45%;
    animation-delay: -12s;
    animation-duration: 16s;
}

.particle-5 {
    left: 45%;
    top: 80%;
    width: 3px;
    height: 3px;
    animation-delay: -5s;
    animation-duration: 24s;
}

.particle-6 {
    left: 60%;
    top: 35%;
    width: 6px;
    height: 6px;
    animation-delay: -9s;
    animation-duration: 19s;
}

@keyframes float-particle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(30px, -50px) scale(1.2);
        opacity: 0.6;
    }
    50% {
        transform: translate(-20px, -100px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(50px, -30px) scale(1.1);
        opacity: 0.5;
    }
}

/* ===== ENHANCED ANIMATIONS ===== */

/* Staggered card entrance with more dramatic effect */
@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.animate-card-reveal {
    animation: cardReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Shimmering gold effect */
@keyframes goldShimmerPremium {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.shimmer-gold {
    background: linear-gradient(
        90deg,
        rgba(203, 182, 119, 0.1) 0%,
        rgba(212, 196, 138, 0.3) 25%,
        rgba(203, 182, 119, 0.1) 50%,
        rgba(212, 196, 138, 0.3) 75%,
        rgba(203, 182, 119, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: goldShimmerPremium 4s ease-in-out infinite;
}

/* Hover lift effect with glow */
.hover-lift {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow:
        0 30px 60px -15px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(203, 182, 119, 0.15);
}

/* Ambient glow pulse for featured elements */
@keyframes ambientGlow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(203, 182, 119, 0.2);
    }
    50% {
        box-shadow: 0 0 50px rgba(203, 182, 119, 0.35);
    }
}

.ambient-glow {
    animation: ambientGlow 4s ease-in-out infinite;
}

/* ===== SELECT/DROPDOWN STYLING FOR DARK THEME ===== */

.game-card select,
.glass-card-dark select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbb677' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.game-card select option,
.glass-card-dark select option {
    background-color: #1a1625;
    color: #f7e7ce;
    padding: 0.75rem;
}

/* ===== LEADERBOARD CARD ===== */

.leaderboard-card {
    background: linear-gradient(
        160deg,
        rgba(45, 31, 71, 0.5) 0%,
        rgba(26, 22, 37, 0.85) 30%,
        rgba(13, 12, 18, 0.95) 100%
    );
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Leaderboard row hover with gold accent */
.leaderboard-row {
    position: relative;
    transition: all 0.3s ease;
}

.leaderboard-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #cbb677 0%, #a8965f 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.leaderboard-row:hover::before {
    opacity: 1;
}

.leaderboard-row:hover {
    transform: translateX(4px);
}

/* First place row special glow */
.leaderboard-row:first-child {
    position: relative;
}

.leaderboard-row:first-child::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(203, 182, 119, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 640px) {
    .particle {
        display: none;
    }

    .game-card {
        min-height: 280px;
    }

    .leaderboard-row:hover {
        transform: translateX(2px);
    }
}
