/* Crossword Viewer Styles */
.crossword-grid {
    display: grid;
    gap: 1px;
    background-color: #363636;
    padding: 10px;
    border-radius: 8px;
    max-width: fit-content;
    margin: 0 auto;
}

.crossword-cell {
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

.crossword-cell:hover {
    background-color: #f5f5f5;
    border-color: #3273dc;
}

.crossword-cell.active {
    background-color: #e3f2fd;
    border-color: #3273dc;
    box-shadow: 0 0 0 2px rgba(50, 115, 220, 0.2);
}

.crossword-cell.blocked {
    background-color: #363636;
    border-color: #363636;
    cursor: default;
}

.crossword-cell.revealed {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.crossword-cell.incorrect {
    background-color: #ffebee;
    color: #c62828;
    animation: shake 0.3s ease-in-out;
}

.crossword-cell.number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    font-weight: normal;
    color: #666;
    line-height: 1;
}

/* Input styling for crossword cells */
.crossword-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    outline: none;
    text-transform: uppercase;
}

.crossword-input:focus {
    background-color: transparent;
}

/* Clue list styling */
.clue-list {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.clue-list.is-active {
    display: block;
}

.clue-item {
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clue-item:hover {
    background-color: #f5f5f5;
}

.clue-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #3273dc;
}

.clue-number {
    font-weight: bold;
    color: #3273dc;
    margin-right: 8px;
}

.clue-text {
    color: #4a4a4a;
    line-height: 1.4;
}

.clue-answer {
    color: #2e7d32;
    font-weight: bold;
    margin-left: 8px;
}

/* Timer styling */
#timer-display {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    background-color: #f5f5f5;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background-color: #3273dc;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background-color: #48c774;
}

.toast.error {
    background-color: #f14668;
}

.toast.warning {
    background-color: #ffdd57;
    color: #363636;
}

/* Modal styling enhancements */
.modal-card-body {
    min-height: 200px;
}

#hint-content {
    line-height: 1.6;
}

/* Responsive design */
@media (max-width: 768px) {
    .crossword-cell {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .crossword-grid {
        padding: 5px;
        gap: 1px;
    }

    .columns {
        flex-direction: column;
    }

    .column.is-8,
    .column.is-4 {
        width: 100%;
        max-width: 100%;
    }

    .field.is-grouped {
        flex-direction: column;
        align-items: stretch;
    }

    .field.has-addons {
        flex-direction: column;
        align-items: stretch;
    }

    .control {
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .crossword-cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .crossword-cell.number {
        font-size: 8px;
        top: 1px;
        left: 1px;
    }

    .title.is-2 {
        font-size: 1.5rem;
    }

    .title.is-4 {
        font-size: 1.25rem;
    }
}

/* Animation for incorrect answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3273dc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.crossword-cell:focus {
    outline: 3px solid #3273dc;
    outline-offset: 2px;
}

.clue-item:focus {
    outline: 2px solid #3273dc;
    outline-offset: 1px;
}

/* Print styles */
@media print {
    .navbar,
    .box.controls,
    .toast-container {
        display: none;
    }

    .crossword-cell {
        border: 1px solid #000;
        background-color: white !important;
        color: black !important;
    }

    .crossword-cell.blocked {
        background-color: #000 !important;
    }
}
