/* Tailwind CSS will handle most of the styling. You can add custom styles here if needed. */

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    transition: all 0.5s ease;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    transition: all 0.3s ease;
}

#quiz-container {
    text-align: center;
    margin: 20px;
}

#question {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    animation: questionAppear 0.5s ease-out;
}

@keyframes questionAppear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#options button {
    display: block;
    margin: 5px auto;
    padding: 10px 20px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#options button:hover {
    background-color: #0056b3;
}

#next-button {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#next-button:hover {
    background-color: #218838;
}

#leaderboard-container {
    margin-top: 20px;
}

#leaderboard {
    list-style: none;
    padding: 0;
}

#leaderboard li {
    background: #f8f9fa;
    margin: 5px 0;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style for progress bar */
#progress-bar {
    height: 8px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressPulse 2s infinite;
}

@keyframes progressPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Style for selected option */
.option-button.selected {
    background-color: #667eea;
    color: white;
    transform: scale(1.05);
}

/* Add styles for timer and animations */
#timer {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    animation: timerPulse 1s infinite;
}

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

/* Add animations and transitions for the landing page */
#landing-page {
    animation: fadeIn 2s ease-in-out;
    transition: transform 0.3s ease-in-out;
}

#landing-page:hover {
    transform: scale(1.05);
}

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

/* Card animations */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

/* Score animation */
#score {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    transition: all 0.3s ease;
}

#score.increase {
    animation: scoreIncrease 0.5s ease-out;
}

@keyframes scoreIncrease {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Responsive design */
@media (max-width: 768px) {
    #app {
        padding: 1rem;
        max-width: 100%;
    }

    .card {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
    }

    #question {
        font-size: 1.2rem;
        margin: 1rem 0;
        padding: 0 0.5rem;
    }

    .option-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        margin: 0.5rem 0;
    }

    #timer, #score {
        font-size: 1.2rem;
        margin: 0.5rem 0;
    }

    #options {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 1rem;
    }

    #next-button {
        width: 100%;
        margin: 1rem 0;
        padding: 1rem;
    }

    .leaderboard-item {
        padding: 0.8rem;
        margin: 0.5rem 0;
    }

    .stat-card {
        width: 100%;
        margin: 0.5rem 0;
    }

    .power-up-button {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    #app {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
        margin: 0.5rem;
        width: calc(100% - 1rem);
    }

    #question {
        font-size: 1rem;
        margin: 0.8rem 0;
    }

    .option-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
    }

    #timer, #score {
        font-size: 1rem;
    }

    #options {
        padding: 0 0.5rem;
    }

    .leaderboard-item {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 0.8rem;
    }

    .power-up-button {
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .welcome-text {
        font-size: 1.5rem;
        padding: 0 0.5rem;
    }

    .category-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Landscape mode adjustments */
@media (max-height: 480px) and (orientation: landscape) {
    .card {
        padding: 0.8rem;
    }

    #question {
        font-size: 0.9rem;
        margin: 0.5rem 0;
    }

    .option-button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    #timer, #score {
        font-size: 0.9rem;
    }
}

/* Dark theme support */
.dark-theme {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
}

.dark-theme .card {
    background: rgba(26, 26, 46, 0.95);
    color: #ffffff;
}

.dark-theme .option-button {
    background: rgba(26, 26, 46, 0.9);
    color: #ffffff;
}

.dark-theme .option-button:hover {
    border-color: #764ba2;
}

/* Loading animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Button animations */
.button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Leaderboard animations */
.leaderboard-item {
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateX(10px);
    background: rgba(102, 126, 234, 0.1);
}

/* Stats animations */
.stat-item {
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.05);
    background: rgba(102, 126, 234, 0.2);
}

/* Form animations */
input, select {
    transition: all 0.3s ease;
}

input:focus, select:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5);
}

/* Error message animation */
.error-message {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Enhanced animations and transitions */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.5); }
    50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.8); }
    100% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.5); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes rotate3D {
    from {
        transform: rotate3d(1, 1, 0, 0deg);
    }
    to {
        transform: rotate3d(1, 1, 0, 360deg);
    }
}

/* Enhanced card styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeScale 0.6s ease-out;
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    animation: glow 2s infinite;
}

/* Enhanced option buttons */
.option-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    font-weight: 600;
    text-transform: uppercase;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    overflow: hidden;
    margin: 0.5rem 0;
    position: relative;
    overflow: hidden;
    -webkit-background-clip: text;
    background-clip: text;
}

.option-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.option-button:hover::before {
    left: 100%;
}

.option-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

/* Enhanced progress bar */
.progress-bar {
    height: 10px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Enhanced timer */
.timer {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.1);
    animation: pulse 1.5s infinite;
    transition: all 0.3s ease;
}

/* Enhanced score display */
.score {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.score.increase {
    animation: scoreIncrease 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scoreIncrease {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Enhanced feedback messages */
.feedback-message {
    text-align: center;
    padding: 1rem;
    border-radius: 15px;
    margin: 1rem 0;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.5s forwards;
}

.feedback-message.correct {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.feedback-message.wrong {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 2px solid #f44336;
}

/* Enhanced power-up buttons */
.power-up-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.power-up-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.power-up-button:hover::after {
    left: 100%;
}

.power-up-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Enhanced loading spinner */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite, glow 2s infinite;
}

/* Enhanced category badge */
.category-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-weight: 600;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
    -webkit-background-clip: text;
    background-clip: text;
}

/* Enhanced results summary */
.results-summary {
    animation: fadeScale 0.6s ease-out;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-summary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Enhanced stat cards */
.stat-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.5s forwards;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Enhanced streak counter */
.streak-counter {
    animation: pulse 1.5s infinite;
    transition: all 0.3s ease;
}

.streak-counter:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.3);
}

/* Enhanced theme toggle */
.theme-toggle {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: rotate3D 2s infinite;
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
}

/* Enhanced leaderboard items */
.leaderboard-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.5s forwards;
}

.leaderboard-item:hover {
    transform: translateX(10px) scale(1.02);
    background: rgba(102, 126, 234, 0.2);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Enhanced question text */
#question {
    animation: fadeScale 0.6s ease-out;
    transition: all 0.3s ease;
}

#question:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Enhanced next button */
#next-button {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#next-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

#next-button:hover::after {
    left: 100%;
}

#next-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

/* Enhanced correct/wrong animations */
.correct {
    animation: correctAnswer 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.wrong {
    animation: wrongAnswer 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes wrongAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* Welcome message gradient effect */
.welcome-text {
    background: linear-gradient(135deg, #667eea, #764ba2, #ff6b6b, #ffa502);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientText 8s ease infinite;
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin: 2rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    padding: 0 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

@keyframes gradientText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Responsive styles for welcome text */
@media (max-width: 768px) {
    .welcome-text {
        font-size: 2.5rem;
        margin: 1.5rem 0;
        padding: 0 0.8rem;
    }
}

@media (max-width: 480px) {
    .welcome-text {
        font-size: 2rem;
        margin: 1rem 0;
        padding: 0 0.5rem;
        line-height: 1.2;
    }
}

@media (max-width: 360px) {
    .welcome-text {
        font-size: 1.8rem;
        margin: 0.8rem 0;
        padding: 0 0.3rem;
    }
}

/* Landscape mode adjustments for welcome text */
@media (max-height: 480px) and (orientation: landscape) {
    .welcome-text {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
}

/* Navigation bar mobile styles */
@media (max-width: 768px) {
    .nav-bar {
        padding: 0.5rem 1rem;
    }

    .nav-logo h1 {
        font-size: 1.5rem;
    }

    .nav-logo img {
        height: 2rem;
        width: 2rem;
    }

    .nav-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .nav-button svg {
        width: 1rem;
        height: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-bar {
        padding: 0.5rem;
    }

    .nav-logo h1 {
        font-size: 1.2rem;
    }

    .nav-logo img {
        height: 1.8rem;
        width: 1.8rem;
    }

    .nav-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .nav-button span {
        display: flex;
        align-items: center;
    }

    .nav-button svg {
        margin-right: 0.3rem;
    }
}

/* Congratulations text mobile styles */
.congratulations-text {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #667eea, #764ba2, #9f7aea);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientText 4s ease infinite;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    text-align: center;
    margin: 1rem 0;
    padding: 0 1rem;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

@keyframes gradientText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Results page mobile styles */
@media (max-width: 768px) {
    .score-summary {
        padding: 1rem;
    }

    .score-summary h3 {
        font-size: 1.5rem;
    }

    .score-summary .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .score-summary .bg-white {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .score-summary {
        padding: 0.8rem;
    }

    .score-summary h3 {
        font-size: 1.2rem;
    }

    .score-summary .bg-white {
        padding: 0.8rem;
    }

    .score-summary .flex {
        font-size: 0.9rem;
    }
}