/**
 * Crossword (Mots Fleches) Activity Styles
 * Mobile-first design
 *
 * @package Crowdaa_Challenges_Calendar
 * @since 4.12.331
 */

/* ========== CONTAINER ========== */

.crossword-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 16px;
}

/* ========== GAME INTERFACE ========== */

.cw-game {
    background: white;
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Header */
.cw-header {
    text-align: center;
    margin-bottom: 20px;
}

.cw-header-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.cw-header-icon svg {
    color: white;
}

.cw-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 8px 0;
}

.cw-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Stats container (progress + timer) */
.cw-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

/* Progress bar */
.cw-progress {
    flex: 1;
}

.cw-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.cw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.cw-progress-text {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

/* Timer */
.cw-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #dcfce7;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
    color: #166534;
    white-space: nowrap;
}

.cw-timer svg {
    color: #22c55e;
}

.cw-timer-warning {
    background: linear-gradient(135deg, #fecaca 0%, #fee2e2 100%);
    color: #dc2626;
    animation: cw-timer-pulse 0.5s ease-in-out infinite alternate;
}

.cw-timer-warning svg {
    color: #dc2626;
}

@keyframes cw-timer-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* Grid */
.cw-grid-wrapper {
    margin-bottom: 20px;
    overflow-x: auto;
}

.cw-grid {
    display: grid;
    gap: 2px;
    background: #1d2327;
    border-radius: 8px;
    padding: 4px;
    min-width: fit-content;
}

.cw-cell {
    width: 32px;
    height: 32px;
    position: relative;
}

.cw-cell-empty {
    background: #1d2327;
}

.cw-cell-active {
    background: white;
    border-radius: 2px;
}

.cw-cell-active.cw-correct {
    background: #dcfce7;
}

.cw-cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 8px;
    font-weight: 700;
    color: #6b7280;
    line-height: 1;
}

.cw-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
    text-transform: uppercase;
    padding: 0;
    outline: none;
    caret-color: #22c55e;
}

.cw-cell-active:focus-within {
    z-index: 10;
    box-shadow: 0 0 0 2px #22c55e;
    border-radius: 4px;
}

.cw-input:focus {
    background: #f0fdf4;
}

/* Definitions */
.cw-definitions {
    margin-bottom: 20px;
}

.cw-def-section {
    margin-bottom: 16px;
}

.cw-def-section:last-child {
    margin-bottom: 0;
}

.cw-def-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 10px;
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dcfce7;
}

.cw-def-title svg {
    color: #22c55e;
}

.cw-def-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cw-def-item {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.cw-def-item.cw-def-found {
    background: #dcfce7;
}

.cw-def-item.cw-def-found .cw-def-number {
    color: #166534;
}

.cw-def-number {
    font-weight: 700;
    color: #22c55e;
    min-width: 24px;
}

.cw-def-text {
    color: #374151;
    line-height: 1.4;
}

/* Validate button */
.cw-validate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.cw-validate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

.cw-validate-btn:active {
    transform: scale(0.98);
}

.cw-validate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Points info */
.cw-points-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #dcfce7;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #166534;
}

.cw-points-info svg {
    color: #22c55e;
}

/* ========== RESULTS ========== */

.cw-results-header {
    text-align: center;
    margin-bottom: 24px;
}

.cw-results-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.cw-results-icon svg {
    color: white;
}

.cw-results-title {
    font-size: 24px;
    font-weight: 700;
    color: #166534;
    margin: 0 0 8px 0;
}

.cw-results-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Points badge */
.cw-results-points {
    text-align: center;
    margin-bottom: 24px;
}

.cw-points-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
}

.cw-points-badge.cw-has-points {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.cw-points-badge.cw-no-points {
    background: #f3f4f6;
    color: #6b7280;
}

.cw-points-value {
    font-size: 28px;
    font-weight: 700;
}

.cw-points-label {
    font-size: 14px;
}

/* Results words */
.cw-results-words {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
}

.cw-results-words-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 14px;
}

.cw-results-words-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cw-result-word {
    padding: 12px;
    border-radius: 8px;
}

.cw-result-word.cw-correct {
    background: #dcfce7;
}

.cw-result-word.cw-incorrect {
    background: #fee2e2;
}

.cw-result-word-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cw-result-word.cw-correct .cw-result-word-header svg {
    color: #16a34a;
}

.cw-result-word.cw-incorrect .cw-result-word-header svg {
    color: #dc2626;
}

.cw-result-number {
    font-weight: 700;
    color: #374151;
}

.cw-result-answer {
    font-weight: 700;
    text-transform: uppercase;
}

.cw-result-word.cw-correct .cw-result-answer {
    color: #166534;
}

.cw-result-word.cw-incorrect .cw-result-answer {
    color: #dc2626;
}

.cw-result-definition {
    font-size: 13px;
    color: #6b7280;
    padding-left: 24px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 360px) {
    .cw-cell {
        width: 28px;
        height: 28px;
    }

    .cw-input {
        font-size: 14px;
    }

    .cw-cell-number {
        font-size: 7px;
    }
}

@media (min-width: 480px) {
    .cw-game,
    .cw-results {
        padding: 32px 28px;
    }

    .cw-cell {
        width: 36px;
        height: 36px;
    }

    .cw-input {
        font-size: 18px;
    }

    .cw-cell-number {
        font-size: 9px;
    }
}
