/* Crossword Game Styles */
.crossword-game {
    max-width: 1200px;
    margin: 20px auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.crossword-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.crossword-title {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 2em;
    font-weight: bold;
}

.crossword-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.difficulty {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.difficulty-easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-hard {
    background: #f8d7da;
    color: #721c24;
}

.crossword-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.crossword-game .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    background: #007cba;
    color: white;
}

.crossword-game .btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.crossword-game .btn-hint {
    background: #28a745;
}

.crossword-game .btn-hint:hover {
    background: #218838;
}

.crossword-game .btn-check {
    background: #17a2b8;
}

.crossword-game .btn-check:hover {
    background: #138496;
}

.crossword-game .btn-clear {
    background: #dc3545;
}

.crossword-game .btn-clear:hover {
    background: #c82333;
}

.crossword-game .btn-solve {
    background: #6f42c1;
}

.crossword-game .btn-solve:hover {
    background: #5a32a3;
}

.crossword-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {
    .crossword-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.crossword-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crossword-grid {
    display: grid;
    gap: 1px;
    background: #333;
    border: 2px solid #333;
    border-radius: 5px;
    padding: 1px;
    margin-bottom: 15px;
}

.crossword-game .grid-cell {
    position: relative;
    width: 35px;
    height: 35px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crossword-game .grid-cell.black-cell {
    background: #333;
}

.crossword-game .grid-cell.highlighted {
    background: #e3f2fd !important;
}

.crossword-game .cell-input {
    width: 100% !important;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 16px !important;
    font-weight: bold;
    text-transform: uppercase;
    background: transparent;
    outline: none;
    caret-color: #007cba;
    padding: 0px !important;
}

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

.crossword-game .cell-input.active {
    background: #007cba !important;
    color: white;
}

.crossword-game .cell-input.hint-cell {
    background: #fff3cd !important;
    color: #856404;
}

.crossword-game .cell-input.correct {
    background: #d4edda !important;
    color: #155724;
}

.crossword-game .cell-input.incorrect {
    background: #f8d7da !important;
    color: #721c24;
    animation: shake 0.5s;
}

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

.crossword-game .cell-number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    font-weight: bold;
    color: #666;
    line-height: 1;
    pointer-events: none;
}

.crossword-game .crossword-status {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-weight: bold;
}

.crossword-game .timer, .progress {
    display: flex;
    align-items: center;
    gap: 5px;
}

.crossword-clues {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    max-height: 600px;
    overflow-y: auto;
}

.crossword-clues h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.2em;
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
}

.clues-across {
    margin-bottom: 25px;
}

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

.clue-item {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    border: 1px solid #e9ecef;
}

.clue-item:hover {
    background: #e3f2fd;
    border-color: #007cba;
}

.clue-item.active {
    background: #007cba;
    color: white;
    border-color: #005a87;
}

.clue-number {
    font-weight: bold;
    min-width: 25px;
    color: #007cba;
}

.clue-item.active .clue-number {
    color: white;
}

.clue-text {
    flex: 1;
    line-height: 1.4;
}

.completion-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

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

.completion-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.completion-content h3 {
    color: #28a745;
    margin: 0 0 15px 0;
    font-size: 1.5em;
}

.completion-stats {
    background: #f8f9fa;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
}

.completion-stats p {
    margin: 5px 0;
    font-size: 0.9em;
}

.check-result {
    background: #17a2b8;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    animation: slideInUp 0.3s ease;
}

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

/* Admin Styles */
.crossword-grid.admin-grid {
    grid-template-columns: repeat(var(--grid-width, 15), 40px);
}

.crossword-grid.admin-grid .grid-cell {
    width: 40px;
    height: 40px;
}

.cell-controls {
    position: absolute;
    top: 0;
    right: 0;
}

.toggle-black {
    background: none;
    border: none;
    font-size: 8px;
    cursor: pointer;
    padding: 1px;
    opacity: 0.7;
}

.toggle-black:hover {
    opacity: 1;
}

.clues-section {
    margin: 20px 0;
}

.clue-input {
    margin: 5px 0;
}

.clue-input input {
    width: 100%;
    max-width: 400px;
    margin-left: 10px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

#crossword-admin-app .nav-tab-wrapper {
    margin-bottom: 20px;
}

#crossword-admin-app .tab-content {
    display: none;
}

#crossword-admin-app .tab-content.active {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .crossword-game {
        padding: 10px;
    }
    
    .crossword-title {
        font-size: 1.5em;
    }
    
    .crossword-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .crossword-controls {
        flex-wrap: wrap;
    }
    
    .crossword-game .btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .crossword-game .grid-cell {
        width: 30px;
        height: 30px;
    }
    
    .crossword-game .cell-input {
        font-size: 14px;
    }
    
    .crossword-clues {
        max-height: 400px;
    }
    
    .completion-content {
        padding: 20px;
        margin: 10px;
    }
}

/* Print styles */
@media print {
    .crossword-controls,
    .crossword-status,
    .crossword-game .btn {
        display: none !important;
    }
    
    .crossword-game {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .crossword-main {
        grid-template-columns: 1fr;
    }
    
    .crossword-grid {
        border: 2px solid #000;
    }
    
    .crossword-game .grid-cell {
        border: 1px solid #000;
    }
    
    .crossword-game .cell-input {
        font-size: 12px;
    }
}