/* ==========================================
   CROSSWORD PAGE STYLES
   ========================================== */

.crossword-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Header Section */
.crossword-header {
    text-align: center;
    margin-bottom: 48px;
}

.crossword-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #000;
    margin-bottom: 8px;
}

.puzzle-date {
    font-size: 16px;
    color: #666;
    margin-bottom: 16px;
}

.puzzle-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    color: #666;
}

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

.stat-item svg {
    opacity: 0.7;
}

/* Main Layout */
.crossword-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 48px;
    align-items: start;
}

/* Grid Wrapper */
.crossword-grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Crossword Grid */
.crossword-grid {
    display: grid;
    gap: 2px;
    background: #e0e0e0;
    border: 2px solid #000;
    padding: 2px;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1;
}

/* Grid size is set dynamically via data attribute */
.crossword-grid[data-grid-size="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.crossword-grid[data-grid-size="6"] {
    grid-template-columns: repeat(6, 1fr);
}

.cell {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-black {
    background: #000;
}

.cell-white {
    background: #fff;
    cursor: text;
    transition: all 0.2s ease;
}

.cell-white:hover {
    background: #f0f0f0;
}

.cell-white:focus-within {
    background: #FEF3C7;
    outline: 3px solid #F59E0B;
    outline-offset: -3px;
    z-index: 10;
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #000;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    color: #000;
    caret-color: transparent;
}

.cell-input:focus {
    outline: none;
}

/* Cell States */
.cell-white.correct {
    background: #D1FAE5;
}

.cell-white.incorrect {
    background: #FEE2E2;
    animation: shake 0.3s;
}

.cell-white.revealed {
    background: #DBEAFE;
}

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

/* Action Buttons */
.crossword-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: #16A34A;
    color: #fff;
}

.btn-primary:hover {
    background: #15803D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-outline {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-outline:hover {
    background: #000;
    color: #fff;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Clues Section */
.crossword-clues {
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: sticky;
    top: 24px;
}

.clues-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
}

.clues-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clue-item {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.clue-item:hover {
    background: #f5f5f5;
}

.clue-item.active {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding-left: 8px;
}

.clue-number {
    font-weight: 700;
    color: #000;
    min-width: 24px;
}

.clue-text {
    color: #333;
    line-height: 1.5;
}

/* Success Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: #fff;
    padding: 48px;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    font-size: 32px;
    font-weight: 700;
    color: #000;
    margin-bottom: 16px;
}

.modal-content p {
    font-size: 18px;
    color: #666;
    margin-bottom: 12px;
}

.solve-time {
    font-size: 24px;
    font-weight: 700;
    color: #16A34A;
    margin-bottom: 32px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .crossword-main {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .crossword-clues {
        position: static;
    }

    .clues-section {
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .crossword-container {
        padding: 24px 16px;
    }

    .crossword-header {
        margin-bottom: 32px;
    }

    .crossword-header h1 {
        font-size: 24px;
    }

    .crossword-grid {
        max-width: 100%;
        gap: 1px;
        padding: 1px;
    }

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

    .crossword-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        padding: 32px 24px;
        margin: 16px;
    }

    .modal-actions {
        flex-direction: column;
        width: 100%;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

