/* Root Variables */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: #1e293b;
    --card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: backgroundPulse 15s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.quiz-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-radius: 20px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    animation: fadeInDown 0.8s ease-out;
}

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

.main-title {
    font-family: 'Raleway', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.author {
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Quiz Content */
.quiz-content {
    animation: fadeIn 1s ease-out;
}

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

/* Section Styles */
.quiz-section {
    margin-bottom: 3rem;
    animation: slideInUp 0.6s ease-out;
}

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

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.3) 0%, transparent 100%);
    border-left: 5px solid var(--primary-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.section-title:hover {
    transform: translateX(10px);
    box-shadow: var(--shadow-md);
}

/* Questions Container */
.questions-container {
    display: grid;
    gap: 1.5rem;
}

/* Question Card */
.question-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.8rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.question-card:hover::before {
    transform: scaleX(1);
}

.question-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
}

/* Question Text */
.question-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    font-weight: 500;
    line-height: 1.7;
}

.q-number {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Options Container */
.options {
    display: grid;
    gap: 0.8rem;
}

/* Option Style */
.option {
    padding: 1rem 1.5rem;
    background: rgba(51, 65, 85, 0.5);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.option:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.option:hover::before {
    transform: translateX(0);
}

/* Active Option */
.option.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: var(--text-primary);
    font-weight: 600;
}

/* Correct Answer */
.option.correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.3));
    border-color: var(--success-color);
    color: var(--text-primary);
    animation: correctPulse 0.6s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.option.correct::after {
    content: '✓';
    position: absolute;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--success-color);
    font-weight: bold;
    animation: checkMark 0.5s ease;
}

@keyframes checkMark {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Wrong Answer */
.option.wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.3));
    border-color: var(--error-color);
    color: var(--text-primary);
    animation: wrongShake 0.5s ease;
}

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

.option.wrong::after {
    content: '✗';
    position: absolute;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--error-color);
    font-weight: bold;
    animation: crossMark 0.5s ease;
}

@keyframes crossMark {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Disabled State */
.option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Footer */
.quiz-footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
}

.footer-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5);
}

.scroll-top i {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
        padding: 0.8rem 1rem;
    }

    .question-card {
        padding: 1.2rem;
    }

    .question-text {
        font-size: 1rem;
    }

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

    .quiz-header {
        padding: 1.5rem;
    }

    .scroll-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .question-text {
        font-size: 0.95rem;
    }

    .option {
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .scroll-top {
        display: none;
    }

    .question-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Selection Styles */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gradient-start);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Accessibility */
.option:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f8fafc;
        --text-secondary: #e2e8f0;
    }
}