/**
 * ================================================================
 * Spot the Difference - Trouve les Erreurs (Mobile-First v4.11.0)
 * ================================================================
 *
 * Jeu d'observation où l'utilisateur doit trouver les erreurs
 * sur une image avec chronomètre et scoring
 * Architecture mobile-first avec breakpoints progressifs
 *
 * @package    Crowdaa_Challenges_Calendar
 * @subpackage Assets/CSS
 * @since      4.11.0
 */

/* ================================================================
   1. CONTAINER
   ================================================================ */
.spot-difference-container {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--cal-spacing-lg, 20px);
    font-family: var(--cal-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

@media (min-width: 768px) {
    .spot-difference-container {
        max-width: 900px;
        padding: var(--cal-spacing-xl, 30px);
    }
}

/* ================================================================
   2. HEADER & INSTRUCTIONS
   ================================================================ */
.spot-game-header {
    text-align: center;
    margin-bottom: var(--cal-spacing-xl, 30px);
}

.spot-game-header h2 {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 700;
    color: var(--cal-text, #2B3674);
    margin-bottom: var(--cal-spacing-md, 15px);
}

.spot-description {
    font-size: var(--cal-font-size-base, 16px);
    color: var(--cal-text-muted, #718096);
    line-height: 1.6;
    margin-bottom: var(--cal-spacing-md, 15px);
}

.spot-instructions {
    font-size: var(--cal-font-size-sm, 14px);
    color: var(--cal-text-light, #A0AEC0);
    line-height: 1.5;
}

.penalty-warning {
    display: block;
    margin-top: var(--cal-spacing-sm, 10px);
    padding: var(--cal-spacing-sm, 10px);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-radius: var(--cal-radius-md, 12px);
    font-weight: 600;
}

/* ================================================================
   3. TIMER MÉMORISATION (v4.12.7 - Banner style Bootstrap)
   ================================================================ */
.spot-memorization-timer-banner {
    margin: var(--cal-spacing-lg, 20px) 0;
    padding: var(--cal-spacing-lg, 20px);
    background: linear-gradient(135deg, #0dcaf0 0%, #0891b2 100%);
    border-left: 5px solid #0891b2;
    border-radius: var(--cal-radius-md, 12px);
    text-align: center;
    color: white;
    font-size: var(--cal-font-size-xl, 22px);
    box-shadow: 0 4px 15px rgba(13, 202, 240, 0.3);
    animation: pulse-banner 2s ease-in-out infinite;
}

.spot-memorization-timer-banner.warning {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border-left-color: #ee5a52;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: pulse-warning-banner 1s ease-in-out infinite;
}

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

@keyframes pulse-warning-banner {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6); }
}

/* ================================================================
   4. STATS BAR (v4.12.7 - Grid 2 colonnes responsive)
   ================================================================ */
.spot-game-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--cal-spacing-md, 15px);
    margin-bottom: var(--cal-spacing-xl, 30px);
}

.spot-game-stats .stat-box {
    display: flex;
    align-items: center;
    gap: var(--cal-spacing-md, 15px);
    padding: var(--cal-spacing-lg, 20px);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-radius: var(--cal-radius-lg, 16px);
    border: 2px solid rgba(102, 126, 234, 0.1);
    transition: all var(--cal-transition-base, 0.3s ease);
}

/* v4.12.8 - Removed .stat-box-full - Now 2x2 grid (4 equal boxes) */

.spot-game-stats .stat-box.warning .stat-value {
    color: #ff6b6b;
    animation: pulse-warning 1s infinite;
}

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

.spot-game-stats .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--cal-radius-full, 9999px);
    background: linear-gradient(135deg, var(--cal-primary, #667eea) 0%, var(--cal-secondary, #764ba2) 100%);
    color: white;
    flex-shrink: 0;
}

.spot-game-stats .stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spot-game-stats .stat-label {
    font-size: var(--cal-font-size-sm, 13px);
    color: var(--cal-text-muted, #718096);
    font-weight: 500;
}

.spot-game-stats .stat-value {
    font-size: var(--cal-font-size-lg, 18px);
    color: var(--cal-text, #2B3674);
    font-weight: 700;
}

/* Animations flash */
.stat-box.flash-success {
    animation: flash-success 0.5s ease;
}

.stat-box.flash-error {
    animation: flash-error 0.5s ease;
}

@keyframes flash-success {
    0%, 100% { background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%); }
    50% { background: linear-gradient(135deg, rgba(5, 205, 153, 0.2) 0%, rgba(0, 184, 148, 0.2) 100%); }
}

@keyframes flash-error {
    0%, 100% { background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%); }
    50% { background: linear-gradient(135deg, rgba(255, 107, 107, 0.2) 0%, rgba(238, 90, 82, 0.2) 100%); }
}

/* ================================================================
   4. IMAGE INTERACTIVE
   ================================================================ */
.spot-game-board {
    margin-bottom: var(--cal-spacing-xl, 30px);
}

.spot-image-container {
    position: relative;
    width: 100%;
    border-radius: var(--cal-radius-xl, 20px);
    overflow: hidden;
    box-shadow: var(--cal-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.1));
    background: white;
}

.spot-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.spot-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
}

.spot-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

/* ================================================================
   5. MARQUEURS VISUELS
   ================================================================ */
.spot-marker {
    position: absolute;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    border-radius: var(--cal-radius-full, 9999px);
    pointer-events: none;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spot-marker.show {
    opacity: 1;
    transform: scale(1);
}

.spot-marker.correct {
    border: 4px solid #05cd99;
    background: rgba(5, 205, 153, 0.2);
    box-shadow: 0 0 0 0 rgba(5, 205, 153, 0.7);
    animation: ripple-correct 1s ease-out;
}

.spot-marker.correct::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #05cd99;
}

.spot-marker.wrong {
    border: 4px solid #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    animation: ripple-wrong 1s ease-out;
}

.spot-marker.wrong::before {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #ff6b6b;
}

@keyframes ripple-correct {
    0% {
        box-shadow: 0 0 0 0 rgba(5, 205, 153, 0.7);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(5, 205, 153, 0);
    }
}

@keyframes ripple-wrong {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(255, 107, 107, 0);
    }
}

/* ================================================================
   6. BOUTONS D'ACTION
   ================================================================ */
.spot-game-actions {
    display: flex;
    flex-direction: column;
    gap: var(--cal-spacing-md, 15px);
    margin-top: var(--cal-spacing-xl, 30px);
}

@media (min-width: 768px) {
    .spot-game-actions {
        flex-direction: row;
        justify-content: center;
    }
}

.spot-restart-btn,
.spot-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cal-spacing-sm, 10px);
    padding: 16px 32px;
    border: none;
    border-radius: var(--cal-radius-full, 9999px);
    font-size: var(--cal-font-size-base, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cal-transition-base, 0.3s ease);
    box-shadow: var(--cal-shadow-button, 0 4px 15px rgba(102, 126, 234, 0.3));
    flex: 1;
}

@media (min-width: 768px) {
    .spot-restart-btn,
    .spot-submit-btn {
        flex: 0 1 auto;
        min-width: 180px;
    }
}

.spot-restart-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: var(--cal-primary, #667eea);
    border: 2px solid var(--cal-primary, #667eea);
}

.spot-restart-btn:hover {
    background: linear-gradient(135deg, var(--cal-primary, #667eea) 0%, var(--cal-secondary, #764ba2) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--cal-shadow-button-hover, 0 8px 25px rgba(102, 126, 234, 0.4));
}

.spot-submit-btn {
    background: linear-gradient(135deg, #05cd99 0%, #00b894 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(5, 205, 153, 0.3);
}

.spot-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(5, 205, 153, 0.4);
}

.spot-restart-btn .btn-icon,
.spot-submit-btn .btn-icon {
    display: flex;
    align-items: center;
}

/* ================================================================
   7. RÉSULTAT COMPLÉTÉ
   ================================================================ */
.spot-completed {
    text-align: center;
}

.user-spot-result {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: var(--cal-radius-2xl, 24px);
    padding: var(--cal-spacing-2xl, 40px) var(--cal-spacing-lg, 20px);
    margin-bottom: var(--cal-spacing-xl, 30px);
}

.user-spot-result h3 {
    font-size: var(--cal-font-size-xl, 24px);
    color: var(--cal-text, #2B3674);
    margin-bottom: var(--cal-spacing-xl, 30px);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* v4.12.10 - Force 2 colonnes (comme spot-game-stats) */
    gap: var(--cal-spacing-lg, 20px);
}

.result-stats .stat-item {
    display: inline-grid;
    align-items: center;
    gap: var(--cal-spacing-md, 15px);
    padding: var(--cal-spacing-lg, 20px);
    background: white;
    border-radius: var(--cal-radius-lg, 16px);
    box-shadow: var(--cal-shadow-sm, 0 2px 10px rgba(0, 0, 0, 0.05));
}

.result-stats .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--cal-radius-full, 9999px);
    background: linear-gradient(135deg, var(--cal-primary, #667eea) 0%, var(--cal-secondary, #764ba2) 100%);
    color: white;
    flex-shrink: 0;
}

.result-stats .stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.result-stats .stat-value {
    font-size: var(--cal-font-size-lg, 18px);
    color: var(--cal-text, #2B3674);
    font-weight: 700;
}

.result-stats .stat-label {
    font-size: var(--cal-font-size-sm, 13px);
    color: var(--cal-text-muted, #718096);
    font-weight: 500;
}

/* ================================================================
   8. LEADERBOARD
   ================================================================ */
.spot-leaderboard-section {
    margin-top: var(--cal-spacing-xl, 30px);
}

.view-spot-leaderboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cal-spacing-sm, 10px);
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--cal-primary, #667eea) 0%, var(--cal-secondary, #764ba2) 100%);
    color: white;
    border: none;
    border-radius: var(--cal-radius-full, 9999px);
    font-size: var(--cal-font-size-base, 16px);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--cal-shadow-button, 0 4px 15px rgba(102, 126, 234, 0.3));
    transition: all var(--cal-transition-base, 0.3s ease);
}

.view-spot-leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cal-shadow-button-hover, 0 8px 25px rgba(102, 126, 234, 0.4));
}

/* Modal Leaderboard */
.spot-leaderboard-modal {
    color: white;
}

.spot-leaderboard-close {
    position: fixed;
    top: 20px;
    left: 20px;
    height: 44px;
    padding: 0 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100001;
}

.leaderboard-content {
    max-width: 800px;
    margin: 0 auto;
}

.leaderboard-content h2 {
    font-size: clamp(24px, 5vw, 32px);
    margin-bottom: var(--cal-spacing-xl, 30px);
    color: white !important;
}

.leaderboard-table {
    width: 100%;
    background: white;
    border-radius: var(--cal-radius-xl, 20px);
    overflow: hidden;
    box-shadow: var(--cal-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.1));
}

.leaderboard-table thead {
    background: linear-gradient(135deg, var(--cal-primary, #667eea) 0%, var(--cal-secondary, #764ba2) 100%);
    color: white;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 16px;
    text-align: left;
}

.leaderboard-table th {
    font-weight: 600;
    font-size: var(--cal-font-size-sm, 14px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--cal-text, #2B3674);
}

.leaderboard-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.7);
}

/* ================================================================
   9. RESPONSIVE MOBILE
   ================================================================ */
@media (max-width: 767px) {
    /* v4.12.7 - Garder 2 colonnes sur mobile, juste réduire padding */
    .spot-game-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--cal-spacing-sm, 10px);
    }

    .spot-game-stats .stat-box {
        padding: var(--cal-spacing-md, 15px);
        gap: var(--cal-spacing-sm, 10px);
    }

    .spot-game-stats .stat-icon {
        width: 36px;
        height: 36px;
    }

    .spot-game-stats .stat-label {
        font-size: 12px;
    }

    .spot-game-stats .stat-value {
        font-size: 16px;
    }

    /* v4.12.7 - Timer banner responsive */
    .spot-memorization-timer-banner {
        font-size: var(--cal-font-size-lg, 18px);
        padding: var(--cal-spacing-md, 15px);
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr); /* v4.12.10 - Garde 2 colonnes sur mobile */
        gap: var(--cal-spacing-md, 15px);
    }

    .spot-marker {
        width: 40px;
        height: 40px;
        margin-left: -20px;
        margin-top: -20px;
    }

    .spot-marker::before {
        font-size: 20px;
    }

    .leaderboard-table {
        font-size: var(--cal-font-size-sm, 13px);
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
    }
}

/* ================================================================
   10. ERREUR / VIDE
   ================================================================ */
.spot-error {
    text-align: center;
    padding: var(--cal-spacing-2xl, 40px) var(--cal-spacing-lg, 20px);
    background: rgba(255, 107, 107, 0.1);
    border-radius: var(--cal-radius-xl, 20px);
    border: 2px dashed rgba(255, 107, 107, 0.3);
}

.spot-error p {
    color: var(--cal-text-muted, #718096);
    font-size: var(--cal-font-size-base, 16px);
}
