/* Crossword Puzzle Styles */

/* Lesson Selection */
.lesson-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
    text-align: left;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.lesson-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lesson-checkbox:hover {
    background: #f7fafc;
    border-color: #667eea;
}

.lesson-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.lesson-checkbox span {
    font-size: 1em;
    color: #2d3748;
}

.crossword-area {
    padding: 2rem 0;
}

.crossword-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 1rem;
}

.puzzle-info {
    display: flex;
    gap: 2rem;
    font-weight: 600;
    color: #667eea;
}

.puzzle-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.puzzle-settings {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.puzzle-settings label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.puzzle-settings select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
}

.crossword-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Crossword Grid */
.crossword-grid {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: inline-grid;
    gap: 1px;
    background: #ccc;
    border: 2px solid #667eea;
}

.crossword-cell {
    width: 35px;
    height: 35px;
    background: white;
    border: 1px solid #ddd;
    position: relative;
    cursor: pointer;
}

.crossword-cell.black {
    background: #333;
    cursor: default;
}

.crossword-cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    outline: none;
    background: transparent;
}

.crossword-cell input:focus {
    background: #e3f2fd;
}

.crossword-cell.selected {
    background: #bbdefb;
}

.crossword-cell.highlighted {
    background: #e3f2fd;
}

.crossword-cell.correct {
    background: #c8e6c9;
}

.crossword-cell.incorrect {
    background: #ffcdd2;
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 10px;
    font-weight: bold;
    color: #667eea;
}

/* Clues Section */
.crossword-clues {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
}

.clues-section {
    margin-bottom: 2rem;
}

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

.clues-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.clue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.clue-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.clue-item:hover {
    background: #e3f2fd;
    border-left-color: #667eea;
}

.clue-item.active {
    background: #bbdefb;
    border-left-color: #667eea;
    font-weight: 600;
}

.clue-item.completed {
    background: #c8e6c9;
    border-left-color: #4caf50;
    opacity: 0.7;
}

.clue-number {
    display: inline-block;
    min-width: 30px;
    font-weight: bold;
    color: #667eea;
}

.clue-text {
    color: #333;
}

/* Completion Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.modal-content p {
    font-size: 1.2rem;
    margin: 0.5rem 0;
    color: #333;
}

#completion-score {
    font-weight: bold;
    color: #4caf50;
    font-size: 1.5rem;
}

.modal-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

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

    .crossword-grid {
        justify-self: center;
    }
}

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

    .crossword-cell input {
        font-size: 14px;
    }

    .cell-number {
        font-size: 8px;
    }

    .crossword-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .puzzle-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
