/**
 * Crossword Game Styles
 */

/* Teacher Description */
.crossword-teacher-description {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.crossword-teacher-description p:last-child {
    margin-bottom: 0;
}

.crossword-admin-note {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: inherit;
}

/* Container */
.crossword-game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 12px;
}

/* Fullscreen mode */
.crossword-game-container.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    max-width: none;
    border-radius: 0;
    overflow: auto;
    padding: 30px;
}

/* Toolbar */
.crossword-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f5f5f5;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
}

.crossword-title {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.crossword-toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.crossword-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
}

.crossword-timer-icon {
    font-size: 1.2rem;
}

.crossword-timer-display {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    font-family: 'Courier New', monospace;
}

.crossword-fullscreen-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.crossword-fullscreen-btn:hover {
    background: #e8e8e8;
    transform: scale(1.05);
}

.crossword-fullscreen-btn svg {
    width: 20px;
    height: 20px;
    fill: #555;
}

/* Main content - vertical layout */
.crossword-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Grid wrapper */
.crossword-grid-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Grid - transparent background, only cells visible */
.crossword-grid {
    display: inline-grid;
    gap: 0;
    position: relative;
}

.crossword-row {
    display: contents;
}

/* Cell - larger size, using box-shadow for clean borders */
.crossword-cell {
    width: 44px;
    height: 44px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1px #333;
}

/* Empty/blocked cells - invisible */
.crossword-cell.blocked {
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.crossword-cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    line-height: 1;
}

.crossword-cell-input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    background: transparent;
    padding: 0;
    outline: none;
    color: #333;
}

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

.crossword-cell.selected {
    background: #fff9c4;
    box-shadow: inset 0 0 0 1px #333;
}

.crossword-cell.current {
    background: #bbdefb;
    box-shadow: inset 0 0 0 2px #1976d2;
}

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

.crossword-cell.correct .crossword-cell-input {
    color: #2e7d32;
}

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

.crossword-cell.incorrect .crossword-cell-input {
    color: #c62828;
}

/* Actions */
.crossword-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.crossword-check-btn {
    display: inline-block;
    padding: 0.75em 1.5em;
    background: #2270b8;
    color: #fff;
    border: none;
    border-radius: 0.5em;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.crossword-check-btn:hover {
    background: #1a5a9a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 112, 184, 0.35);
}

/* Clues - horizontal layout below grid */
.crossword-clues {
    width: 100%;
    max-width: 900px;
    display: flex;
    gap: 40px;
    justify-content: center;
}

.crossword-clues-across,
.crossword-clues-down {
    flex: 1;
    max-width: 400px;
}

.crossword-clues h3 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #4caf50;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

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

.crossword-clues-list li {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.crossword-clues-list li:hover {
    background: #f5f5f5;
}

.crossword-clues-list li.active {
    background: #e3f2fd;
}

.crossword-clues-list li.completed {
    background: #e8f5e9;
}

.crossword-clues-list li.completed .clue-text {
    text-decoration: line-through;
    color: #4caf50;
}

.clue-number {
    font-weight: 700;
    color: #4caf50;
    min-width: 30px;
    font-size: 1.1rem;
}

.clue-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.clue-text {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Message */
.crossword-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.crossword-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.crossword-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== Sekcja zapisu wyniku ===== */
.omni-save-result-section {
    max-width: 400px;
    margin: 18px auto 0;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.omni-save-checkbox-label {
    display: block;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    color: #4f883d;
}

.omni-save-checkbox-label input {
    margin-right: 8px;
    transform: scale(1.2);
    vertical-align: middle;
}

.omni-learner-name-field {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.omni-learner-name-field > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    text-align: center;
}

.omni-learner-name-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 54px;
}

.omni-learner-name-input:focus {
    outline: none;
    border-color: #4f883d;
    box-shadow: 0 0 0 3px rgba(79, 136, 61, 0.15);
}

.omni-learner-name-input:read-only {
    background: #f0f0f0;
    cursor: not-allowed;
}

.omni-save-result-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    margin: 8px 0 12px;
    background: linear-gradient(135deg, #4f883d 0%, #3e6c31 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.omni-save-result-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 136, 61, 0.3);
}

.omni-save-result-btn.saved {
    background-color: #4f883d !important;
    cursor: default;
}

.omni-save-result-btn:disabled {
    opacity: 0.7;
}

.omni-privacy-note {
    margin: 0 0 10px;
    font-size: 12px;
    color: #666;
}

.omni-save-result-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.omni-save-result-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.omni-save-result-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 600px) {
    .omni-save-result-section {
        max-width: 100%;
        padding: 15px;
    }
}

/* Summary Modal */
.crossword-summary-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.crossword-summary-modal.active {
    display: flex;
}

.crossword-summary-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

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

.crossword-summary-modal-content h3 {
    margin: 0 0 20px;
    font-size: 1.8rem;
    color: #2d3748;
}

.crossword-summary-modal-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    text-align: left;
}

.crossword-summary-modal-content ul li {
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    color: #4a5568;
    padding: 10px 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #4f883d;
}

.crossword-summary-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.crossword-summary-actions button {
    border-radius: 10px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    transition: all 0.2s ease;
}

.crossword-summary-close {
    background: #e2e8f0;
    color: #4a5568;
}

.crossword-summary-close:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.crossword-summary-restart {
    background: linear-gradient(135deg, #4f883d 0%, #3e6c31 100%);
    color: #fff;
}

.crossword-summary-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 136, 61, 0.4);
}

.crossword-summary-pdf {
    background: #fff;
    color: #4f883d;
    border: 2px solid #4f883d !important;
}

.crossword-summary-pdf:hover {
    background: #f7fafc;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 900px) {
    .crossword-clues {
        flex-direction: column;
        align-items: center;
    }
    
    .crossword-clues-across,
    .crossword-clues-down {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .crossword-grid-wrapper {
        width: 100%;
        overflow-x: auto;
    }
    
    .crossword-cell {
        width: 38px;
        height: 38px;
    }
    
    .crossword-cell-input {
        font-size: 1.2rem;
    }
    
    .crossword-cell-number {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .crossword-game-container {
        padding: 10px;
    }
    
    .crossword-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .crossword-title {
        font-size: 1.2rem;
    }
    
    .crossword-cell {
        width: 32px;
        height: 32px;
    }
    
    .crossword-cell-input {
        font-size: 1rem;
    }
    
    .crossword-cell-number {
        font-size: 8px;
    }
}
