/* Custom styles for Gabby and Savvy's Quiz Game - v1.0.8 */

/* Global styles - more like original */
:root {
    --primary-color: #8a2be2; /* Vibrant purple */
    --secondary-color: #ff69b4; /* Pink */
    --success-color: #28a745; /* Green */
    --danger-color: #dc3545; /* Red */
    --background-gradient: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --btn-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --movie-color: #ff9900; /* Orange for movie theme */
    --math-color: #00aaff; /* Blue for math theme */
}

body {
    background-image: var(--background-gradient);
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Hide class for screens */
.hide {
    display: none !important;
}

/* Main container styling */
.container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Button styling with fun colors */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--btn-shadow);
    transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #7126b3;
    border-color: #7126b3;
    transform: translateY(-2px);
}

/* Animation for correct and wrong answers */
.btn-success {
    animation: pulse-success 0.5s;
}

.btn-danger {
    animation: pulse-wrong 0.5s;
}

@keyframes pulse-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes pulse-wrong {
    0% { transform: scale(1); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: scale(1); }
}

/* Quiz option cards styling */
#movie-option, #math-option {
    transition: transform 0.3s ease;
    cursor: pointer;
}

#movie-option:hover, #math-option:hover {
    transform: translateY(-10px);
}

/* Leaderboard links styling */
#view-movie-leaderboard, #view-math-leaderboard {
    cursor: pointer;
    text-decoration: underline;
    display: inline-block;
    margin-top: 5px;
    transition: color 0.2s;
}

#view-movie-leaderboard:hover, #view-math-leaderboard:hover {
    color: var(--secondary-color);
}

/* Math question specific styling */
.math-question {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
}

/* Make question categories smaller and less prominent, positioned above question */
#question-text small {
    font-size: 0.7rem;
    opacity: 0.7;
    display: block;
    margin-bottom: 12px;
    color: #6c757d;
    order: -1; /* Move to top when using flexbox */
}

/* Make the question container a flex container for reordering */
#question-text {
    display: flex;
    flex-direction: column;
}

/* Home and fullscreen buttons */
.position-fixed .btn {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
    cursor: pointer;
    z-index: 1000;
}

.position-fixed .btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

#home-btn {
    background-color: var(--primary-color);
    color: white;
}

/* Timer and score display */
#timer, #score {
    font-weight: bold;
    color: var(--primary-color);
}

/* Answer buttons styling */
.answer-btn {
    text-align: left;
    min-height: 3.5rem;
    background-color: #f8f9fa !important; /* Light gray background */
    color: #212529 !important; /* Dark text */
    border: 1px solid #dee2e6 !important; /* Light border */
    box-shadow: none !important;
    outline: none !important;
}

/* Add transition only for desktop users */
@media (pointer: fine) {
    .answer-btn {
        transition: all 0.2s ease !important;
    }
}

/* Desktop-only hover effect for answer buttons */
@media (pointer: fine) {
    .answer-btn:hover {
        background-color: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.2s ease !important;
    }
}

/* Base button state rules for mobile and other states */
.answer-btn:focus, .answer-btn:active, .answer-btn.active {
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    background-color: #f8f9fa !important; /* Light gray background */
    color: #212529 !important; /* Dark text */
    border-color: #dee2e6 !important; /* Light border */
}

/* Make correct/wrong classes override all other states */
.answer-btn.correct, 
.answer-btn.correct:hover, 
.answer-btn.correct:focus, 
.answer-btn.correct:active {
    background-color: var(--success-color) !important;
    color: white !important;
    border-color: var(--success-color) !important;
}

.answer-btn.wrong, 
.answer-btn.wrong:hover, 
.answer-btn.wrong:focus, 
.answer-btn.wrong:active {
    background-color: var(--danger-color) !important;
    color: white !important;
    border-color: var(--danger-color) !important;
}

/* Mobile-specific button styling with no state effects */
@media (pointer: coarse) {
    /* Custom button style for mobile that won't have hover/active states */
    .mobile-btn {
        background-color: #f8f9fa !important; /* Light gray background */
        color: #212529 !important; /* Dark text */
        border: 1px solid #dee2e6 !important; /* Light border */
        box-shadow: none !important;
        outline: none !important;
        transition: none !important; /* Disable all transitions */
        -webkit-tap-highlight-color: transparent !important; /* Remove tap highlight */
        -webkit-touch-callout: none !important; /* Disable callout */
        -webkit-user-select: none !important; /* Disable selection */
        user-select: none !important;
        appearance: none !important; /* Use native appearance */
    }
    
    /* Override ALL possible states that could cause blue color or any state change */
    .mobile-btn:hover,
    .mobile-btn:focus,
    .mobile-btn:active,
    .mobile-btn.active,
    .mobile-btn.focus,
    .mobile-btn:focus-visible,
    .mobile-btn:visited,
    .mobile-btn:target,
    .mobile-btn.btn-primary,
    .mobile-btn.btn-primary:hover,
    .mobile-btn.btn-primary:active,
    .mobile-btn.btn-primary.active,
    .mobile-btn::-moz-focus-inner,
    .mobile-btn::backdrop {
        background-color: #f8f9fa !important;
        color: #212529 !important;
        border-color: #dee2e6 !important;
        box-shadow: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    
    /* Add correct/wrong state styling */
    .mobile-btn.correct {
        background-color: var(--success-color) !important;
        color: white !important;
        border-color: var(--success-color) !important;
    }
    
    .mobile-btn.wrong {
        background-color: var(--danger-color) !important;
        color: white !important;
        border-color: var(--danger-color) !important;
    }
}

/* Button wrapper to isolate button styling */
.button-wrapper {
    margin-bottom: 10px;
}

/* Mobile optimizations */
@media (max-width: 576px) {
    h1 {
        font-size: 2rem;
    }
    
    #question-text {
        font-size: 1.2rem;
    }
    
    .answer-btn {
        font-size: 0.9rem;
        min-height: 60px; /* Ensure touch targets are large enough */
    }
    
    /* Only fix for skip button without affecting other buttons */
    #skip-btn:hover, 
    #skip-btn:active, 
    #skip-btn:focus, 
    #skip-btn.active {
        background-color: transparent !important;
        color: #6c757d !important; 
        border-color: #6c757d !important;
    }
    
    /* Make sure correct/wrong answers show properly */
    .answer-btn.correct {
        background-color: var(--success-color) !important;
        color: white !important;
        border-color: var(--success-color) !important;
    }
    
    .answer-btn.wrong {
        background-color: var(--danger-color) !important;
        color: white !important;
        border-color: var(--danger-color) !important;
    }
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Fix for fixed buttons on mobile */
@media (max-width: 576px) {
    .position-fixed .btn {
        width: 40px !important;
        height: 40px !important;
    }
}

/* High scores styling */
#high-scores-list .list-group-item:nth-child(even) {
    background-color: rgba(138, 43, 226, 0.05);
}

/* End screen styling */
#final-score {
    color: var(--primary-color);
    font-weight: bold;
}

/* Welcome Screen Animations */
/* Animated title */
.animated-title {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: title-bounce 2s ease-in-out infinite;
}

.movie-title {
    color: var(--movie-color);
    font-weight: bold;
    animation: color-pulse 2s ease-in-out infinite alternate;
}

.math-title {
    color: var(--math-color);
    font-weight: bold;
    animation: color-pulse 2s ease-in-out infinite alternate-reverse;
}

.tagline {
    font-size: 1.1rem;
    font-style: italic;
    color: #6c6c6c;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
    animation: fade-in 1.5s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes color-pulse {
    0% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    100% { text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); }
}

/* Animation container styles */
.animation-container {
    position: relative;
    height: 220px; /* Increased height to fit name labels */
    margin: 30px auto;
    overflow: hidden;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Floating elements */
.floating-elements {
    position: absolute;
    width: 100%;
    height: 100%;
}

.floating-item {
    position: absolute;
    font-size: 2rem;
    animation: float-around 12s linear infinite;
    opacity: 0.8;
}

.math-item {
    color: var(--math-color);
}

.movie-item {
    color: var(--movie-color);
}

/* Assign different positions and delays to elements */
.floating-item:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; animation-duration: 15s; }
.floating-item:nth-child(2) { top: 20%; left: 80%; animation-delay: -1s; animation-duration: 18s; }
.floating-item:nth-child(3) { top: 60%; left: 20%; animation-delay: -2s; animation-duration: 13s; }
.floating-item:nth-child(4) { top: 80%; left: 70%; animation-delay: -3s; animation-duration: 16s; }
.floating-item:nth-child(5) { top: 30%; left: 40%; animation-delay: -4s; animation-duration: 14s; }
.floating-item:nth-child(6) { top: 70%; left: 30%; animation-delay: -5s; animation-duration: 17s; }
.floating-item:nth-child(7) { top: 15%; left: 60%; animation-delay: -6s; animation-duration: 19s; }
.floating-item:nth-child(8) { top: 45%; left: 80%; animation-delay: -7s; animation-duration: 12s; }
.floating-item:nth-child(9) { top: 60%; left: 50%; animation-delay: -8s; animation-duration: 15s; }
.floating-item:nth-child(10) { top: 35%; left: 20%; animation-delay: -9s; animation-duration: 16s; }
.floating-item:nth-child(11) { top: 85%; left: 15%; animation-delay: -10s; animation-duration: 14s; }
.floating-item:nth-child(12) { top: 5%; left: 40%; animation-delay: -11s; animation-duration: 18s; }

@keyframes float-around {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(50px, 20px) rotate(90deg) scale(1.1);
    }
    50% {
        transform: translate(20px, 50px) rotate(180deg) scale(1);
    }
    75% {
        transform: translate(-30px, 20px) rotate(270deg) scale(0.9);
    }
    100% {
        transform: translate(0, 0) rotate(360deg) scale(1);
    }
}

/* Bouncing characters */
.bouncing-character {
    position: absolute;
    bottom: 60px; /* Moved up from bottom */
    width: 100%;
    height: 50px;
    z-index: 2;
}

.character {
    position: absolute;
    bottom: 0;
    font-size: 3.2rem; /* Increased size */
    animation: bounce 1.5s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.char-emoji {
    position: relative;
    z-index: 2;
}

.accessory {
    position: absolute;
    font-size: 1.5rem; /* Larger accessories */
    z-index: 3;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

.movie-accessory {
    top: -8px;
    right: -15px;
    transform: rotate(15deg);
}

.math-accessory {
    top: -8px;
    left: -15px;
    transform: rotate(-15deg);
}

#character1 {
    left: 30%;
    animation-delay: 0s;
}

#character1::after {
    content: "Gabby";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem; /* Larger text */
    color: var(--movie-color);
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-weight: bold;
    background: rgba(255, 255, 255, 0.7); /* Add background for better visibility */
    padding: 2px 8px;
    border-radius: 10px;
}

#character2 {
    left: 60%;
    animation-delay: 0.75s;
}

#character2::after {
    content: "Savvy";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem; /* Larger text */
    color: var(--math-color);
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-weight: bold;
    background: rgba(255, 255, 255, 0.7); /* Add background for better visibility */
    padding: 2px 8px;
    border-radius: 10px;
}

@keyframes bounce {
    0%, 100% { 
        transform: translateY(0) rotate(0deg); 
    }
    50% { 
        transform: translateY(-30px) rotate(10deg); 
    }
}

/* Pulse animation for the start button */
.pulse-animation {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: var(--btn-shadow);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: var(--btn-shadow);
    }
}

/* Help Me Solve styling */
.help-step {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(138, 43, 226, 0.05);
    border-left: 4px solid var(--primary-color);
}

.help-step-title {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.help-step-visual {
    font-size: 1.5rem;
    margin: 1rem 0;
    text-align: center;
}

.help-tip {
    background-color: rgba(255, 243, 205, 0.5);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 4px solid #ffc107;
}

/* Hide Help Me Solve button for levels higher than 1 */
.level-higher #help-me-solve-btn {
    display: none;
}