/* FlagHunt Game Styles */
/* This file contains styles for the FlagHunt flag-to-map game */

/* Import the shared CSS variables from map-style.css structure */
:root {
    --primary-color: #55f5dd;
    --primary-dark: #02254e;
    --secondary-color: #04387e;
    --accent-color: #f093fb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition-normal: 0.3s ease;
    --transition-fast: 0.15s ease;
    --transition-slow: 0.5s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1f2937;
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
        --gray-400: #6b7280;
        --gray-500: #9ca3af;
        --gray-600: #d1d5db;
        --gray-700: #e5e7eb;
        --gray-800: #f3f4f6;
        --gray-900: #f9fafb;
    }
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: radial-gradient( circle farthest-corner at 10% 20%,  rgba(2,37,78,1) 0%, rgba(4,56,126,1) 19.7%, rgba(85,245,221,1) 100.2% );
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== FLAGHUNT SPECIFIC STYLES ===== */

/* Flag Display Area */
.flag-display {
    text-align: center;
    margin-bottom: var(--space-6);
    padding: var(--space-6);
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-2xl);
    border: 2px solid rgba(85, 245, 221, 0.3);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.flag-display:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(85, 245, 221, 0.5);
}

.flag-challenge-text {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: var(--space-4);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
}

.flag-image {
    font-size: 4rem;
    margin: var(--space-4) 0;
    display: block;
    animation: flagPulse 2s ease-in-out infinite;
    cursor: default;
    user-select: none;
    line-height: 1;
}

@keyframes flagPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 4px 8px rgba(85, 245, 221, 0.3));
    }
    50% { 
        transform: scale(1.05);
        filter: drop-shadow(0 8px 16px rgba(85, 245, 221, 0.5));
    }
}

.flag-hint {
    font-size: var(--font-size-base);
    color: var(--secondary-color);
    font-style: italic;
    margin-top: var(--space-3);
    line-height: 1.5;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* FlagHunt Modal Styles */
.flaghunt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(5px);
}

.flaghunt-modal-content {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    position: relative;
    animation: slideInUp 0.3s ease;
    border: 2px solid rgba(85, 245, 221, 0.2);
}

.flaghunt-modal-content h2 {
    text-align: center;
    color: var(--primary-dark);
    font-family: 'Poppins', sans-serif;
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-6);
    font-weight: 700;
}

.flaghunt-modal-buttons {
    margin-top: var(--space-6);
    text-align: center;
}

.flaghunt-modal-buttons .btn {
    background: var(--primary-color);
    color: var(--primary-dark);
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: 25px;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-md);
}

.flaghunt-modal-buttons .btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(85, 245, 221, 0.4);
}

/* Country Visual Feedback */
.flaghunt-completed {
    fill: #51cf66 !important;
    stroke: #40c057 !important;
    stroke-width: 1.5 !important;
    filter: drop-shadow(0 2px 4px rgba(81, 207, 102, 0.4));
}

.flaghunt-incorrect {
    fill: #ff6b6b !important;
    stroke: #ff5252 !important;
    stroke-width: 1.5 !important;
    filter: drop-shadow(0 2px 4px rgba(255, 107, 107, 0.4));
}

/* Country hover effects for FlagHunt */
.country:hover {
    stroke-width: 1 !important;
    filter: drop-shadow(0 2px 4px rgba(74, 144, 226, 0.3));
    cursor: pointer;
}

/* Loading States */
.flag-loading {
    animation: spin 1s linear infinite;
}

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

/* Progress Visualization */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: radial-gradient( circle farthest-corner at 10% 20%,  rgba(2,37,78,1) 0%, rgba(4,56,126,1) 19.7%, rgba(85,245,221,1) 100.2% );
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

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

/* Animations for correct/incorrect answers */
@keyframes correctAnswer {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0%, 100% { transform: scale(1); }
    10%, 30%, 50%, 70%, 90% { transform: scale(1.02); }
    20%, 40%, 60%, 80% { transform: scale(0.98); }
}

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

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

/* Streak indicator styling */
.streak-indicator {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-2) var(--space-4);
    font-weight: 600;
    color: #ff8c00;
    animation: streakGlow 2s ease-in-out infinite;
}

@keyframes streakGlow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    }
}

/* Score popup animations */
.score-popup {
    position: absolute;
    font-weight: bold;
    font-size: var(--font-size-xl);
    color: var(--success-color);
    pointer-events: none;
    animation: scoreFloat 1.5s ease-out forwards;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Responsive Design for FlagHunt */
@media (max-width: 768px) {
    .flag-display {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
    }
    
    .flag-challenge-text {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-3);
    }
    
    .flag-image {
        font-size: 3rem;
        margin: var(--space-3) 0;
    }
    
    .flag-hint {
        font-size: var(--font-size-sm);
        margin-top: var(--space-2);
    }
    
    .flaghunt-modal-content {
        padding: var(--space-6);
        margin: var(--space-4);
    }
    
    .flaghunt-modal-content h2 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-4);
    }
}

@media (max-width: 480px) {
    .flag-display {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-xl);
    }
    
    .flag-challenge-text {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-2);
    }
    
    .flag-image {
        font-size: 2.5rem;
        margin: var(--space-2) 0;
    }
    
    .flag-hint {
        font-size: var(--font-size-xs);
        margin-top: var(--space-1);
    }
    
    .flaghunt-modal-content {
        padding: var(--space-4);
        margin: var(--space-2);
        border-radius: var(--radius-xl);
    }
    
    .flaghunt-modal-content h2 {
        font-size: var(--font-size-lg);
    }
    
    .flaghunt-modal-buttons .btn {
        padding: var(--space-2) var(--space-5);
        font-size: var(--font-size-sm);
        width: 100%;
        max-width: 250px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .flag-display {
        border-width: 3px;
        border-color: var(--primary-dark);
    }
    
    .flag-challenge-text {
        color: var(--gray-900);
        font-weight: 700;
    }
    
    .flaghunt-completed {
        fill: #2d8f47 !important;
        stroke: #1a5928 !important;
    }
    
    .flaghunt-incorrect {
        fill: #d63447 !important;
        stroke: #a02633 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .flag-image {
        animation: none;
    }
    
    .streak-indicator {
        animation: none;
    }
}

/* Focus management for accessibility */
.btn:focus,
.flaghunt-modal-buttons .btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .flaghunt-modal {
        display: none;
    }
    
    .flag-display {
        background: white;
        border: 2px solid #000;
    }
    
    .flag-image {
        animation: none;
    }
}

/* Loading spinner for flag transitions */
.flag-transition-loading {
    opacity: 0.6;
    animation: pulse 1s ease-in-out infinite;
}

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

/* Success celebration effects */
.celebration-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.celebration-particle {
    position: absolute;
    font-size: 1.5rem;
    animation: celebrate 3s linear forwards;
}

@keyframes celebrate {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-10px) rotate(360deg);
        opacity: 0;
    }
}

/* Tooltip enhancements for FlagHunt */
.country-name-tooltip {
    transition: var(--transition-fast);
    pointer-events: none;
}

.country-name-tooltip.visible {
    opacity: 1;
    transform: translateY(-5px);
}

.tooltip-content {
    backdrop-filter: blur(10px);
    border: 2px solid rgba(85, 245, 221, 0.3);
    box-shadow: var(--shadow-lg);
}

/* Game completion celebration */
.completion-celebration {
    background: radial-gradient(circle, rgba(255,215,0,0.9) 0%, rgba(255,140,0,0.7) 100%);
    border: 3px solid gold;
    animation: completionGlow 2s ease-in-out infinite;
}

@keyframes completionGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255,215,0,0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(255,215,0,0.8);
        transform: scale(1.02);
    }
}

/* Error state styling */
.flag-error {
    color: var(--error-color);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}