/**
 * Frontend styles for Puzzle module
 */

.omni-puzzle-game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.omni-puzzle-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;
}

.omni-puzzle-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.omni-puzzle-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.omni-puzzle-controls-left label {
    font-weight: 600;
    font-size: 16px;
}

#omni-puzzle-pieces-select {
    padding: 8px 12px;
    font-size: 16px;
    border: 2px solid #333;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.omni-puzzle-btn {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    background: #4f883d;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.omni-puzzle-btn:hover {
    background: #3e6c31;
}

.omni-puzzle-timer {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
    white-space: nowrap;
}

/* Przycisk pełny ekran - styl jak w innych modułach */
#fullscreen-wrapper {
    display: flex;
    align-items: center;
}

.omni-puzzle-canvas-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

#omni-puzzle-canvas {
    border: 3px solid #333;
    display: block;
    width: 100%;
    height: auto;
    background: #f5f5f5;
    cursor: grab;
    touch-action: none;
    box-sizing: border-box;
}

#omni-puzzle-canvas:active {
    cursor: grabbing;
}

.omni-puzzle-teacher-desc {
    max-width: 1200px;
    margin: 0 auto 20px;
    color: #000;
    font-size: 16px;
    line-height: 1.6;
}

.omni-puzzle-admin-note {
    max-width: 1200px;
    margin: 30px auto 0;
    color: #000;
    font-size: 15px;
    line-height: 1.6;
}

/* Preview image */
.omni-puzzle-preview {
    max-width: 1200px;
    margin: 16px auto 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}

.omni-puzzle-preview-inner {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.omni-puzzle-preview-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
    z-index: 1;
}

.omni-puzzle-preview-zoom-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: #111827;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.omni-puzzle-preview-zoom-btn:hover {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    transform: translateY(-1px);
}

.omni-puzzle-preview-zoom-btn:active {
    transform: scale(0.94);
}

.omni-puzzle-preview-zoom-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #e2e8f0;
    color: #475569;
    border-color: rgba(71, 85, 105, 0.35);
}

.omni-puzzle-preview-img {
    width: 200px;
    height: auto;
    border: 2px solid #333;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: width 0.2s ease, height 0.2s ease;
}

.omni-puzzle-hidden-helper {
    max-width: 1200px;
    margin: 14px auto 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #1f2937;
}

.omni-puzzle-hidden-title {
    font-weight: 600;
    font-size: 16px;
}

.omni-puzzle-hidden-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;
    box-shadow: 0 4px 12px rgba(34, 112, 184, 0.25);
}

.omni-puzzle-hidden-btn:hover {
    background: #1a5a9a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 112, 184, 0.35);
}

.omni-puzzle-hidden-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(34, 112, 184, 0.25);
}

.omni-puzzle-hidden-hint {
    font-size: 14px;
    color: #6b7280;
    max-width: 420px;
}

/* Fullscreen mode - Standard */
.omni-puzzle-game-container:fullscreen {
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-toolbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    margin-bottom: 20px;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-canvas-wrapper {
    max-width: 90%;
    max-height: calc(100vh - 150px);
    display: flex;
    justify-content: center;
}

.omni-puzzle-game-container:fullscreen #omni-puzzle-canvas {
    max-height: calc(100vh - 150px);
    width: auto;
    max-width: 100%;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-preview {
    position: fixed;
    top: 20px;
    right: 20px;
    margin: 0;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    gap: 16px;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-preview-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
    z-index: 2;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-preview-img {
    width: 250px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-preview-zoom-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(148, 163, 184, 0.35);
    color: #0f172a;
}

.omni-puzzle-game-container:fullscreen .omni-puzzle-preview-zoom-btn:hover {
    background: #38bdf8;
    border-color: #0ea5e9;
    color: #0f172a;
}

/* Fullscreen mode - Safari/WebKit */
.omni-puzzle-game-container:-webkit-full-screen {
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-toolbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    margin-bottom: 20px;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-canvas-wrapper {
    max-width: 90%;
    max-height: calc(100vh - 150px);
    display: flex;
    justify-content: center;
}

.omni-puzzle-game-container:-webkit-full-screen #omni-puzzle-canvas {
    max-height: calc(100vh - 150px);
    width: auto;
    max-width: 100%;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-preview {
    position: fixed;
    top: 20px;
    right: 20px;
    margin: 0;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    gap: 16px;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-preview-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
    z-index: 2;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-preview-img {
    width: 250px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-preview-zoom-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(148, 163, 184, 0.35);
    color: #0f172a;
}

.omni-puzzle-game-container:-webkit-full-screen .omni-puzzle-preview-zoom-btn:hover {
    background: #38bdf8;
    border-color: #0ea5e9;
    color: #0f172a;
}

/* Fullscreen mode - Firefox */
.omni-puzzle-game-container:-moz-full-screen {
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-toolbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    margin-bottom: 20px;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-canvas-wrapper {
    max-width: 90%;
    max-height: calc(100vh - 150px);
    display: flex;
    justify-content: center;
}

.omni-puzzle-game-container:-moz-full-screen #omni-puzzle-canvas {
    max-height: calc(100vh - 150px);
    width: auto;
    max-width: 100%;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-preview {
    position: fixed;
    top: 20px;
    right: 20px;
    margin: 0;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    gap: 16px;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-preview-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
    z-index: 2;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-preview-img {
    width: 250px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-preview-zoom-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(148, 163, 184, 0.35);
    color: #0f172a;
}

.omni-puzzle-game-container:-moz-full-screen .omni-puzzle-preview-zoom-btn:hover {
    background: #38bdf8;
    border-color: #0ea5e9;
    color: #0f172a;
}

/* Popup z gratulacjami */
.omni-puzzle-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.omni-puzzle-popup.show {
    opacity: 1;
}

.omni-puzzle-popup-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.omni-puzzle-popup.show .omni-puzzle-popup-content {
    transform: scale(1);
}

.omni-puzzle-popup-content h2 {
    font-size: 32px;
    color: #4CAF50;
    margin: 0 0 20px 0;
}

.omni-puzzle-popup-content p {
    font-size: 18px;
    color: #333;
    margin: 10px 0;
}

.omni-puzzle-popup-content .omni-puzzle-time {
    font-size: 24px;
    font-weight: bold;
    color: #2196F3;
    margin: 20px 0;
}

.omni-puzzle-popup-content .omni-puzzle-btn {
    margin-top: 20px;
    min-width: 150px;
}

.omni-puzzle-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.omni-puzzle-btn-outline {
    background: #ffffff;
    color: #4f883d;
    border: 2px solid #4f883d;
}

.omni-puzzle-btn-outline:hover {
    background: #3e6c31;
    color: #ffffff;
}

.omni-puzzle-summary {
    background: #f5f7fb;
    border-radius: 10px;
    padding: 18px;
    margin-top: 20px;
    text-align: left;
    line-height: 1.5;
}

.omni-puzzle-summary p {
    margin: 6px 0;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .omni-puzzle-toolbar {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        text-align: center;
    }

    .omni-puzzle-controls-left,
    .omni-puzzle-controls-right {
        justify-content: center;
        width: 100%;
    }
    
    .omni-puzzle-timer {
        order: 2;
    }

    .omni-puzzle-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .omni-puzzle-popup-content {
        padding: 30px 20px;
    }
    
    .omni-puzzle-popup-content h2 {
        font-size: 24px;
    }
    
    .omni-puzzle-popup-content p {
        font-size: 16px;
    }
    
    .omni-puzzle-popup-content .omni-puzzle-time {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .omni-puzzle-game-container {
        padding: 10px;
    }

    .omni-puzzle-controls-left label {
        font-size: 14px;
    }

    .omni-puzzle-btn {
        font-size: 14px;
        padding: 8px 12px;
    }

    .omni-puzzle-timer {
        font-size: 16px;
    }
    
    .omni-puzzle-popup-content {
        padding: 20px 15px;
    }
    
    .omni-puzzle-popup-content h2 {
        font-size: 20px;
    }
}
