/**
 * Wordsearch Game - Frontend Styles
 */

/* Container */
.wordsearch-game-container {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Toolbar */
.wordsearch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1rem, 3vw, 2.5rem);
    font-size: clamp(1.1rem, 2.6vw, 1.6rem);
    user-select: none;
    margin-bottom: 20px;
}

.wordsearch-toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wordsearch-timer-display {
    font-weight: 600;
    color: #1e3a8a;
}

.wordsearch-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex: 1;
}

.wordsearch-fullscreen-btn {
    background: #e0e0e0;
    border: none;
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
}

.wordsearch-fullscreen-btn:hover {
    background: #d0d0d0;
}

/* Main layout - legenda nad wykreślanką */
.wordsearch-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Grid */
.wordsearch-grid {
    width: 100%;
    display: flex;
    justify-content: center;
}

.wordsearch-grid-inner {
    display: inline-block;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wordsearch-row {
    display: flex;
}

.wordsearch-cell {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.wordsearch-cell:hover {
    background: #edf2f7;
    transform: scale(1.05);
}

.wordsearch-cell-selected {
    background: #667eea !important;
    color: #fff !important;
    transform: scale(1.1);
    z-index: 1;
    position: relative;
}

.wordsearch-cell-found {
    background: #48bb78 !important;
    color: #fff !important;
}

/* Sidebar - teraz nad wykreślanką */
.wordsearch-sidebar {
    width: 100%;
    order: -1;
}

.wordsearch-sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 10px 0;
    text-align: center;
}

.wordsearch-word-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.wordsearch-word-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.wordsearch-word-item.wordsearch-word-found {
    background: #c6f6d5;
    border-left-color: #48bb78;
    text-decoration: line-through;
    opacity: 0.7;
}

.wordsearch-word-image {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
}

.wordsearch-word-text {
    font-weight: 500;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* Images only mode - pokaż tylko obrazki (tekst ukryty przez JS) */
.wordsearch-images-only .wordsearch-word-item {
    padding: 6px;
}

.wordsearch-images-only .wordsearch-word-image {
    width: 48px;
    height: 48px;
}

/* Słowa bez obrazka w trybie "tylko obrazki" - pokaż tekst normalnie */
.wordsearch-images-only .wordsearch-word-item.wordsearch-no-image {
    padding: 8px 14px;
}

.wordsearch-images-only .wordsearch-word-item.wordsearch-no-image .wordsearch-word-text {
    display: inline;
}

/* Message */
.wordsearch-message {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.wordsearch-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: #fff;
}

.wordsearch-timeout {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: #fff;
}

/* Teacher description */
.wordsearch-teacher-description {
    margin-bottom: 20px;
}

.wordsearch-teacher-description p {
    margin: 0;
    color: #333;
    line-height: 1.6;
}

/* Admin note */
.wordsearch-admin-note {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    margin-top: 20px;
    border-radius: 0 8px 8px 0;
}

.wordsearch-admin-note p {
    margin: 0;
    color: #5d4e37;
    line-height: 1.6;
}

.wordsearch-admin-note::before {
    content: "🔒 Notatka admina";
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #b8860b;
    margin-bottom: 8px;
}

/* Fullscreen mode */
.wordsearch-game-container.wordsearch-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    border-radius: 0;
    z-index: 999999;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
}

.wordsearch-fullscreen .wordsearch-toolbar {
    max-width: 800px;
    width: 100%;
}

.wordsearch-fullscreen .wordsearch-main {
    flex: 1;
    justify-content: center;
    align-items: center;
    max-width: 800px;
    width: 100%;
}

.wordsearch-fullscreen .wordsearch-grid-inner {
    max-width: 600px;
}

/* Completed state */
.wordsearch-game-container.wordsearch-completed .wordsearch-grid-inner {
    animation: celebrate 0.5s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Summary Modal */
.wordsearch-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;
}

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

.wordsearch-summary-modal .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;
}

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

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

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

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

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

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

.wordsearch-summary-modal .omni-learner-name-input:read-only,
.wordsearch-summary-modal .omni-learner-name-input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
}

.wordsearch-summary-modal .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;
}

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

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

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

.wordsearch-summary-modal .omni-privacy-note {
    margin: 0 0 10px;
    font-size: 12px;
    color: #1e1e1e;
    font-style: italic;
    text-align: center;
}

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

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

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

.wordsearch-summary-modal .omni-summary-popup-note--teacher{
    margin: 14px auto 6px;
    max-width: 500px;
    font-size: 14px;
    line-height: 1.45;
    color: #1b1b1b;
}

.wordsearch-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);
    }
}

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

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

.wordsearch-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;
}

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

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

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

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .wordsearch-cell {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .wordsearch-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .wordsearch-title {
        order: -1;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .wordsearch-game-container {
        padding: 10px;
    }
    
    .wordsearch-cell {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .wordsearch-timer-display {
        font-size: 1.2rem;
        padding: 6px 12px;
    }
    
    .wordsearch-word-item {
        padding: 6px 10px;
    }
    
    .wordsearch-word-text {
        font-size: 0.8rem;
    }
}
