/**
 * Quebra-Cabeça Católico - Estilos
 * Versão 2.0 - Design para quebra-cabeça com peças móveis
 */

.cqc-puzzle-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cqc-header {
    text-align: center;
    margin-bottom: 20px;
}

.cqc-header h3 {
    color: white;
    font-size: 28px;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

.cqc-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cqc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: #f0f0f0;
}

/* Área do jogo */
.cqc-game-area {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

/* Tabuleiro do quebra-cabeça */
.cqc-puzzle-board {
    background: white;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.cqc-puzzle-grid {
    position: relative;
    border: 3px solid #333;
    border-radius: 10px;
}

/* Slots (espaços para as peças) */
.cqc-slot {
    border: 1px dashed #ccc;
    box-sizing: border-box;
}

.cqc-slot-hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.cqc-occupied {
    border: none;
}

.cqc-correct-slot {
    box-shadow: inset 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Área de peças */
.cqc-pieces-tray {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    min-width: 300px;
    max-width: 400px;
}

.cqc-pieces-tray h4 {
    color: #667eea;
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 18px;
}

.cqc-pieces-container {
    position: relative;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
    overflow: visible;
}

/* Peças do quebra-cabeça */
.cqc-piece {
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
    user-select: none;
}

.cqc-piece:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.cqc-piece.cqc-dragging {
    opacity: 0.8;
    z-index: 1000 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.cqc-piece.cqc-correct {
    border-color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.cqc-piece-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Animação de dica */
.cqc-hint-piece {
    animation: pulseHint 1s ease-in-out 3;
}

.cqc-hint-slot {
    animation: pulseSlot 1s ease-in-out 3;
    background: rgba(255, 215, 0, 0.3);
}

.cqc-hint-rotation {
    animation: shakeRotation 0.5s ease-in-out 3;
}

@keyframes pulseHint {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

@keyframes pulseSlot {
    0%, 100% { border-color: #ccc; }
    50% { border-color: #ffd700; border-width: 3px; }
}

@keyframes shakeRotation {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Animação de vitória */
.cqc-victory-piece {
    animation: victoryDance 0.6s ease-in-out;
}

@keyframes victoryDance {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Modais */
.cqc-preview-modal,
.cqc-victory-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

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

.cqc-preview-content,
.cqc-victory-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

.cqc-preview-content img,
.cqc-victory-content img {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
}

.cqc-close-preview {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.cqc-close-preview:hover {
    transform: rotate(90deg);
    background: #ff6666;
}

.cqc-victory-content h2 {
    color: #667eea;
    font-size: 42px;
    margin: 0 0 20px 0;
}

.cqc-victory-content p {
    font-size: 24px;
    color: #666;
    margin: 10px 0;
}

.cqc-victory-animation {
    font-size: 60px;
    margin-bottom: 20px;
}

.cqc-victory-animation span {
    display: inline-block;
    animation: bounce 1s ease-in-out infinite;
}

.cqc-victory-animation span:nth-child(2) {
    animation-delay: 0.1s;
}

.cqc-victory-animation span:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.cqc-play-again {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 20px;
}

/* Responsividade */
@media (max-width: 768px) {
    .cqc-puzzle-container {
        padding: 15px;
        margin: 10px;
    }

    .cqc-game-area {
        flex-direction: column;
        align-items: center;
    }

    .cqc-pieces-tray {
        max-width: 100%;
        width: 100%;
    }

    .cqc-pieces-container {
        min-height: 200px;
    }

    .cqc-header h3 {
        font-size: 24px;
    }

    .cqc-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Melhorias de acessibilidade */
.cqc-piece:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* Estilos do admin */
#image_preview img {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

/* Loader */
.cqc-loading {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 20px;
}

/* Melhorias visuais adicionais */
.cqc-puzzle-board {
    position: relative;
}

.cqc-puzzle-board::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 18px;
    z-index: -1;
}
