/* Learn the Bible Game Styles */

/* Card Styles */
.bible-card {
    perspective: 1000px;
    height: 450px;
    cursor: pointer;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
}

.bible-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.bible-card.flipped .bible-card-inner {
    transform: rotateY(180deg);
}

.bible-card-front,
.bible-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 3px solid #8B4513;
    border-radius: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(101, 67, 33, 0.95) 0%, rgba(139, 90, 43, 0.95) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Themed Scrollbar */
.bible-card-front::-webkit-scrollbar,
.bible-card-back::-webkit-scrollbar {
    width: 8px;
}

.bible-card-front::-webkit-scrollbar-track,
.bible-card-back::-webkit-scrollbar-track {
    background: rgba(70, 50, 30, 0.3);
    border-radius: 10px;
}

.bible-card-front::-webkit-scrollbar-thumb,
.bible-card-back::-webkit-scrollbar-thumb {
    background: #D4AF37;
    border-radius: 10px;
}

.bible-card-front::-webkit-scrollbar-thumb:hover,
.bible-card-back::-webkit-scrollbar-thumb:hover {
    background: #F0C800;
}

/* Firefox scrollbar */
.bible-card-front,
.bible-card-back {
    scrollbar-width: thin;
    scrollbar-color: #D4AF37 rgba(70, 50, 30, 0.3);
}

.bible-card-front {
    z-index: 2;
}

.bible-card-back {
    transform: rotateY(180deg);
}

.card-icon {
    font-size: 28px;
    margin-bottom: 15px;
    color: #D4AF37;
    flex-shrink: 0;
}

.grab-bible-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(212, 175, 55, 0.2);
    border: 2px solid #D4AF37;
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #F5E6D3;
    font-size: 0.85rem;
    font-weight: bold;
    z-index: 5;
    animation: pulse-glow 2s ease-in-out infinite;
}

.grab-bible-indicator i {
    font-size: 1.1rem;
    color: #D4AF37;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
        transform: scale(1.02);
    }
}

.card-logo {
    width: 100px;
    margin: 0 auto 15px;
    display: block;
    flex-shrink: 0;
    padding: 15px;
    background: rgba(248, 248, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(248, 248, 255, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
}

.verse-text {
    font-size: 1.3rem;
    line-height: 1.7;
    font-style: italic;
    color: #F5E6D3;
    margin: 20px 0 10px 0;
    flex-grow: 1;
    text-align: center;
    padding: 0 10px;
}

.book-name-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #D4AF37;
    text-align: center;
    margin-bottom: 15px;
}

.instruction-text {
    font-size: 0.9rem;
    color: #F5E6D3;
    text-align: center;
    margin-bottom: 15px;
    padding: 0 10px;
    font-style: italic;
}

.book-options {
    margin: 15px 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
    flex-shrink: 0;
}

.book-option {
    display: inline-flex;
    align-items: center;
    padding: 6px 8px;
    background: rgba(212, 175, 55, 0.15);
    border: 2px solid #D4AF37;
    border-radius: 8px;
    color: #F5E6D3;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    white-space: nowrap;
    flex: 0 1 auto;
}

.book-option:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: scale(1.05);
}

.book-option input[type="radio"] {
    margin-right: 4px;
    transform: scale(1.0);
    cursor: pointer;
    accent-color: #D4AF37;
}

.book-option label {
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.card-back-content {
    color: #F5E6D3;
    text-align: left;
}

.card-back-content .info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    margin-bottom: 15px;
    align-items: baseline;
}

.card-back-content h5 {
    color: #D4AF37;
    margin: 0;
    font-size: 0.9rem;
    font-weight: bold;
}

.card-back-content .reference {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: #F5E6D3;
}

.card-back-content .context-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}

.card-back-content .context-section h5 {
    margin-bottom: 8px;
}

.card-back-content .context {
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
    color: #F5E6D3;
}

.pastor-answer-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}

.ask-pastor-btn {
    background: linear-gradient(45deg, #654321 0%, #8B5A2B 100%);
    border: 2px solid #D4AF37;
    color: #F5E6D3;
    font-weight: bold;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.3s;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ask-pastor-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.6);
    background: linear-gradient(45deg, #7B5230 0%, #A0693B 100%);
}

.ask-pastor-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.pastor-answer {
    margin-top: 15px;
    padding: 15px;
    background: rgba(212, 175, 55, 0.15);
    border: 2px solid #D4AF37;
    border-radius: 8px;
}

.pastor-answer h5 {
    color: #D4AF37;
    margin-bottom: 10px;
    font-size: 1rem;
}

.pastor-answer-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #F5E6D3;
    font-style: italic;
    margin: 0;
}

.submit-btn {
    background: linear-gradient(45deg, #654321 0%, #8B5A2B 100%);
    border: 2px solid #D4AF37;
    color: #F5E6D3;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s;
    flex-shrink: 0;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.5);
    background: linear-gradient(45deg, #7B5230 0%, #A0693B 100%);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Flip Card Button - Allows toggling between front and back after answer submission */
.flip-button-section {
    margin-top: 15px;
    padding-top: 10px;
}

.flip-card-btn {
    background: linear-gradient(45deg, #2C5F2D 0%, #3A7D3B 100%);
    border: 2px solid #90EE90;
    color: #F5E6D3;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s;
    flex-shrink: 0;
    width: 100%;
}

.flip-card-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(144, 238, 144, 0.5);
    background: linear-gradient(45deg, #3A7D3B 0%, #4A9D4B 100%);
}

.flip-card-btn i {
    transition: transform 0.3s;
}

.flip-card-btn:hover i {
    transform: rotate(180deg);
}

/* Result Badge - Circular icon in top-right corner */
.result-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid #F5E6D3;
}

/* Badge should appear normally on the front of the card */
.bible-card-front .result-badge {
    transform: none;
}

/* Badge on the back should also appear normally since the back itself is already flipped */
.bible-card-back .result-badge {
    transform: rotateY(180deg);
}

/* When the card is flipped, adjust badge transforms */
.bible-card.flipped .bible-card-front .result-badge {
    transform: rotateY(180deg);
}

.bible-card.flipped .bible-card-back .result-badge {
    transform: none;
}

.result-badge.correct {
    background: #2E7D32;
    color: white;
}

.result-badge.incorrect {
    background: #C62828;
    color: white;
}

.result-badge i {
    font-size: 18px;
}

/* Fireworks Animation */
.fireworks-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: visible;
}

.firework {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%);
}

.firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #FFD700, #FFA500);
    border-radius: 50%;
    animation: explode 1.2s ease-out forwards;
    box-shadow: 0 0 12px #FFD700, 0 0 20px #FFD700;
}

.firework-particle:nth-child(odd) {
    background: radial-gradient(circle, #FF6B6B, #FF4444);
    box-shadow: 0 0 12px #FF6B6B, 0 0 20px #FF6B6B;
}

.firework-particle:nth-child(3n) {
    background: radial-gradient(circle, #4ECDC4, #45B7AA);
    box-shadow: 0 0 12px #4ECDC4, 0 0 20px #4ECDC4;
}

.firework-particle:nth-child(4n) {
    background: radial-gradient(circle, #FFA500, #FF8C00);
    box-shadow: 0 0 12px #FFA500, 0 0 20px #FFA500;
}

.firework-particle:nth-child(5n) {
    background: radial-gradient(circle, #9B59B6, #8E44AD);
    box-shadow: 0 0 12px #9B59B6, 0 0 20px #9B59B6;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(cos(var(--angle)) * 150px),
            calc(sin(var(--angle)) * 150px)
        ) scale(1.5);
        opacity: 0;
    }
}

/* Centered containers for loading, instruction, and completion cards */
#loadingMessage {
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#loadingMessage[style*="display: block"] {
    display: flex !important;
}

/* Game complete message - only use flex when visible */
#gameCompleteMessage[style*="display: flex"] {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 auto !important;
}

#gameCompleteMessage[style*="display: none"] {
    display: none !important;
}

#gameCompleteMessage .col-12,
#gameCompleteMessage .col-md-10,
#gameCompleteMessage .col-lg-8 {
    display: flex !important;
    justify-content: center !important;
    margin: 0 auto !important;
}

.row:has(#startGameBtn) {
    display: flex;
    justify-content: center;
    align-items: center;
}

#loadingMessage .col-lg-8,
#gameCompleteMessage .col-lg-8 {
    display: flex;
    justify-content: center;
}

#loadingMessage .card,
#gameCompleteMessage .card,
.card:has(#startGameBtn) {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .bible-card {
        height: 500px;
        width: 100%;
    }

    .verse-text {
        font-size: 1rem;
    }

    .book-options {
        flex-direction: column;
        gap: 6px;
        flex-wrap: wrap;
    }

    .book-option {
        width: 100%;
        justify-content: flex-start;
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .card-back-content .info-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .card-back-content h5 {
        margin-top: 8px;
    }
    
    .result-badge {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: -10px;
        right: -10px;
    }
    
    .result-badge i {
        font-size: 16px;
    }
    
    .grab-bible-indicator {
        font-size: 0.75rem;
        padding: 4px 8px;
        top: 8px;
        right: 8px;
    }
    
    .grab-bible-indicator span {
        display: none;
    }
    
    .grab-bible-indicator i {
        font-size: 1rem;
    }
}
