/* ============================================
   WORDLE MODULE CSS
   ============================================ */

/* Difficulty Cards */
.difficulty-card {
    @apply block p-6 bg-white rounded-xl border-2 border-gray-200 hover:border-blue-400 transition-all duration-300 cursor-pointer;
}

/* Wordle Grid */
.wordle-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* Play-page grid container */
.wordle-grid-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
}

.wordle-row {
    display: grid;
    grid-template-columns: repeat(var(--word-length, 5), 1fr);
    gap: 0.25rem;
}

/* Wordle cell */
.wordle-cell {
    aspect-ratio: 1 / 1;
    border: 2px solid #e2e8f0;
    /* slate-200 */
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    background-color: white;
    color: #1e293b;
    /* slate-800 */
    user-select: none;
    transition: border-color 0.15s ease, background-color 0.3s ease;
    /* font-size sätts dynamiskt i JS baserat på ordlängd och skärmbredd */
}

.wordle-cell.filled {
    border-color: #94a3b8;
    /* slate-400 */
    animation: pop 0.1s ease-in-out;
}

.wordle-cell.flip {
    animation: flip 0.6s ease-in-out;
}

/* Use semantic cell state classes from theme.css */
.wordle-cell.correct {
    background-color: #22c55e;
    border-color: #22c55e;
    color: white;
}

.wordle-cell.present {
    background-color: #eab308;
    border-color: #eab308;
    color: white;
}

.wordle-cell.absent {
    background-color: #475569;
    border-color: #475569;
    color: white;
}

/* Keyboard */
.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

.keyboard-key {
    height: 3rem;
    min-width: 0;
    flex: 1;
    border-radius: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    background-color: #f1f5f9;
    color: #475569;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

@media (min-width: 1024px) {
    .keyboard-key {
        height: 3.25rem;
        font-size: 0.9rem;
    }

    .keyboard-row {
        gap: 0.3rem;
        margin-bottom: 0.4rem;
    }
}

.keyboard-key:hover:not(:disabled) {
    background-color: #e2e8f0;
}

.keyboard-key:active {
    transform: scale(0.95);
}

.keyboard-key.key-correct {
    background-color: #22c55e;
    color: white;
    border-color: transparent;
}

.keyboard-key.key-present {
    background-color: #eab308;
    color: white;
    border-color: transparent;
}

.keyboard-key.key-absent {
    background-color: #94a3b8;
    color: white;
    border-color: transparent;
}

/* Legacy class names (keep for backwards compat) */
.keyboard-key.correct {
    background-color: #22c55e;
    color: white;
}

.keyboard-key.present {
    background-color: #eab308;
    color: white;
}

.keyboard-key.absent {
    background-color: #94a3b8;
    color: white;
}

/* 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);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Result page specific styles */
.result-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    padding: 1.5rem;
}

/* Stats cards */
.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 0.75rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* Color utilities for results */
.text-correct {
    color: var(--color-cell-correct);
}

.text-present {
    color: var(--color-cell-present);
}

.text-absent {
    color: var(--color-cell-absent);
}

.bg-correct {
    background-color: var(--color-cell-correct);
}

.bg-present {
    background-color: var(--color-cell-present);
}

.bg-absent {
    background-color: var(--color-cell-absent);
}

/* Helper function for mb_str_split in CSS (visual guide) */
.letter-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin: 0.25rem;
    border-radius: 0.375rem;
    font-weight: bold;
    font-size: 1.5rem;
}