/**
 * Wordle Activity Styles
 *
 * @package Crowdaa_Challenges_Calendar
 * @since   4.12.85
 */

/* Container principal */
.wordle-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* Indice */
.wordle-hint {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
}

.wordle-hint svg {
    color: #d97706;
    flex-shrink: 0;
    margin-top: 2px;
}

.wordle-hint span {
    color: #92400e;
    font-size: 14px;
    line-height: 1.5;
}

/* Info tentatives */
.wordle-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 13px;
    color: #4b5563;
}

.wordle-attempts-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wordle-word-length {
    background: #22c55e;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* Grille Wordle */
.wordle-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.wordle-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.wordle-cell {
    width: 52px;
    height: 52px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    background: white;
    transition: all 0.15s ease;
}

.wordle-cell.filled {
    border-color: #9ca3af;
    animation: pop 0.1s ease;
}

.wordle-cell.correct {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
    animation: flip 0.5s ease;
}

.wordle-cell.present {
    background: #eab308;
    border-color: #eab308;
    color: white;
    animation: flip 0.5s ease;
}

.wordle-cell.absent {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
    animation: flip 0.5s ease;
}

.wordle-cell.shake {
    animation: shake 0.5s ease;
}

.wordle-cell.bounce {
    animation: bounce 0.5s ease;
}

/* Message de feedback */
.wordle-message {
    min-height: 40px;
    margin-bottom: 16px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wordle-message.visible {
    opacity: 1;
}

.wordle-message.error {
    background: #fee2e2;
    color: #dc2626;
}

.wordle-message.success {
    background: #dcfce7;
    color: #16a34a;
}

.wordle-message.info {
    background: #e0f2fe;
    color: #0284c7;
}

/* Clavier virtuel */
.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.key-btn {
    min-width: 32px;
    height: 48px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: #e5e7eb;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-btn:hover {
    background: #d1d5db;
    transform: scale(1.05);
}

.key-btn:active {
    transform: scale(0.95);
}

.key-btn.key-enter,
.key-btn.key-backspace {
    min-width: 50px;
    background: #9ca3af;
    color: white;
}

.key-btn.key-enter:hover,
.key-btn.key-backspace:hover {
    background: #6b7280;
}

.key-btn.correct {
    background: #22c55e;
    color: white;
}

.key-btn.present {
    background: #eab308;
    color: white;
}

.key-btn.absent {
    background: #6b7280;
    color: white;
}

/* Légende */
.wordle-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 12px;
    color: #6b7280;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-box.correct {
    background: #22c55e;
}

.legend-box.present {
    background: #eab308;
}

.legend-box.absent {
    background: #6b7280;
}

/* Solution (après complétion) */
.wordle-solution {
    margin: 20px 0;
}

.wordle-solution p {
    margin-bottom: 12px;
    color: #6b7280;
    font-size: 14px;
}

.solution-word {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.solution-letter {
    width: 48px;
    height: 48px;
    background: #22c55e;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

/* Animations */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Résultats - Header icon SVG styling */
.wordle-completed .results-header .results-icon {
    font-size: 0; /* Hide text/emoji fallback */
}

.wordle-completed .results-header .results-icon svg {
    width: 48px;
    height: 48px;
    stroke: #22c55e;
}

/* Résultats - Grid 2 colonnes sur mobile pour Wordle */
.wordle-results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* Responsive */
@media (max-width: 480px) {
    .wordle-container {
        padding: 15px 10px;
    }

    .wordle-cell {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .key-btn {
        min-width: 26px;
        height: 42px;
        padding: 0 6px;
        font-size: 12px;
    }

    .key-btn.key-enter,
    .key-btn.key-backspace {
        min-width: 40px;
    }

    .wordle-legend {
        gap: 12px;
    }

    .solution-letter {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* 2 cartes par ligne sur mobile */
    .wordle-results-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .wordle-results-stats .result-card {
        padding: 15px 10px;
    }

    .wordle-results-stats .result-icon svg {
        width: 24px;
        height: 24px;
    }

    .wordle-results-stats .result-value {
        font-size: 20px;
    }

    .wordle-results-stats .result-label {
        font-size: 11px;
    }
}
