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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #f1f5f9;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --correct: #22c55e;
    --incorrect: #ef4444;
    --background: #ffffff;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

h1, h2, h3, h4, h5 {
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-dark);
}

h1 {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
    padding: 0;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

/* Updated Start Screen Styles */
.start-screen {
    width: 100%;
    min-height: 100vh;
}

/* Navbar Styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 5%;
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-light);
    font-weight: 500;
    position: relative;
}

.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

/* Hero Section Styles */
.hero-section {
    padding: 5rem 0;
    background: linear-gradient(120deg, #f9fafb 0%, #f3f4f6 100%);
}

.hero-section .container {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.hero-content {
    flex: 1;
}

.hero-content p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    color: var(--text-light);
}

.search-container {
    position: relative;
    max-width: 450px;
}

.search-container input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-container i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* Course Explorer Styles */
.course-explorer {
    padding: 5rem 0;
    background-color: #ffffff;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background-color: transparent;
    color: var(--text-light);
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Updated Unit Cards */
.unit-selection {
    margin: 1.5rem 0;
}

.course-section {
    background-color: white;
    border-radius: 16px;
    margin-bottom: 3rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
}

.course-header {
    background-color: var(--primary);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.course-title h3 {
    margin-bottom: 0.25rem;
    font-size: 1.3rem;
    color: white;
    font-weight: 600;
}

.course-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.course-section .unit-cards {
    padding: 1.5rem;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.unit-card {
    background-color: white;
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.unit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.unit-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.unit-card:hover::before {
    opacity: 1;
}

.unit-card.selected {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.05);
}

.unit-card.selected::before {
    opacity: 1;
}

.unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.unit-badge {
    background-color: var(--primary-light);
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.difficulty {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.unit-card h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.unit-card ul {
    font-size: 0.9rem;
}

.unit-card li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var (--text-light);
}

.unit-card li i {
    color: var(--primary);
}

/* Features Section */
.features-section {
    padding: 5rem 0;
    background-color: #f8fafc;
    text-align: center;
}

.features-section h2 {
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: var (--transition);
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 1.75rem;
    margin: 0 auto 1.5rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* Start Actions */
.start-actions {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

#start-button {
    background-color: var(--primary);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: var(--shadow);
}

#start-button:hover:not(.disabled) {
    transform: translateY(-2px);
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

#start-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Footer Styles */
.footer {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-branding .logo {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: white;
}

.footer-branding p {
    color: #94a3b8;
    margin-bottom: 0;
}

.link-group h4, .social-section h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.link-group a {
    display: block;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.link-group a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.25rem;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    color: #94a3b8;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Quiz Display Styles - UPDATED */
#display-container {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    overflow: hidden;
    transition: all 0.3s ease;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(to right, var(--primary-light), var(--primary));
    color: white;
    position: relative;
}

.quiz-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.unit-title {
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
}

.number-of-question {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.course-info-display {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.15rem;
}

.timer-div {
    background-color: rgba(255, 255, 255, 0.25);
    padding: 0.6rem 0.9rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.timer-div.urgency {
    animation: pulse 1s infinite;
    background-color: rgba(239, 68, 68, 0.25);
}

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

/* Progress Bar - UPDATED */
.progress-container {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #a5b4fc, var(--primary));
    width: 0;
    transition: width 0.4s ease;
}

.quiz-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.quiz-content::-webkit-scrollbar {
    width: 4px;
}

.quiz-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.quiz-content::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 10px;
}

.quiz-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.question {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.75rem;
    color: var(--text-dark);
    line-height: 1.5;
    position: relative;
    padding-left: 1.25rem;
    border-left: 4px solid var(--primary);
}

/* Options Styling - UPDATED */
.option-div {
    width: 100%;
    background: var(--secondary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: left;
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    justify-content: flex-start;
}

.option-div:before {
    content: '';
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    margin-right: 12px;
    margin-top: 3px;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-div:hover:not([disabled]) {
    background: #e9ecf6;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.option-div:active:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.option-div:disabled {
    cursor: default;
}

.option-div.correct {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--correct);
    border-color: var(--correct);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.option-div.correct:before {
    background-color: var(--correct);
    border-color: var(--correct);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 12px;
}

.option-div.incorrect {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--incorrect);
    border-color: var(--incorrect);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.option-div.incorrect:before {
    background-color: var(--incorrect);
    border-color: var(--incorrect);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 12px;
}

/* Quiz Actions - UPDATED */
.quiz-actions {
    padding: 0 2rem;
    margin: -0.5rem 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hint-container {
    position: relative;
    z-index: 20;
}

.btn-hint {
    background-color: #fef3c7;
    color: #d97706;
    padding: 0.4rem 0.9rem;
    border-radius: 30px;
    font-size: 0.85rem;
    transition: all 0.2s;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-hint:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.hint-bubble {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    width: 260px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    padding: 1rem;
    z-index: 30;
    animation: fadeIn 0.3s ease;
    font-size: 0.9rem;
}

.hint-bubble:after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    bottom: -7px;
    left: 20px;
    transform: rotate(45deg);
    box-shadow: 3px 3px 5px rgba(0,0,0,0.05);
}

.hint-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 2px;
    cursor: pointer;
}

.hint-close:hover {
    color: var(--text-dark);
}

.animation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    width: 100px;
    position: relative;
}

.celebration-animation {
    position: absolute;
    animation: zoomInOut 1s ease;
}

.wrong-animation {
    position: absolute;
    animation: shake 0.8s ease;
}

.correct-icon {
    font-size: 2.75rem;
    color: var(--correct);
}

.wrong-icon {
    font-size: 2.75rem;
    color: var(--incorrect);
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

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

/* Quiz Footer - UPDATED */
.quiz-footer {
    background-color: #f8fafc;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--secondary);
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.question-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Button Styles - UPDATED */
.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary i {
    font-size: 1.1rem;
}

.btn-primary:hover:not(.disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:active:not(.disabled) {
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-dark);
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary i {
    font-size: 1.1rem;
}

.btn-secondary:hover:not(.disabled) {
    background-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 50px;
    padding: 0.55rem 1.1rem;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline i {
    font-size: 1rem;
}

.btn-outline:hover:not(.disabled) {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-outline.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#end-button {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    background-color: #f1f5f9;
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#end-button i {
    font-size: 1rem;
}

#end-button:hover {
    background-color: #e2e8f0;
    color: var(--text-dark);
}

.question-dots {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    max-width: 280px;
    justify-content: center;
    align-items: center;
    min-height: 24px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    margin: 3px;
}

.dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.dot.correct {
    background: var(--correct);
}

.dot.incorrect {
    background: var(--incorrect);
}

/* Enhanced Score Container Styles */
.score-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f7ff 0%, #f1f5ff 100%);
    padding: 2rem 0;
}

.results-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 95%;
    max-width: 600px;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    margin: 2rem auto;
}

.confetti {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.25);
}

.score-header {
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

.score-header h2 {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    background: linear-gradient(to right, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.unit-name {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.course-name {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

#user-score {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 1.2rem 0;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: linear-gradient(to right, #f0f9ff, #e0f2fe);
    color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.score-chart-container {
    width: 100%;
    height: 200px;
    margin: 2rem 0;
}

.performance-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat {
    padding: 1.25rem 1rem;
    border-radius: var(--border-radius);
    background-color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid #e5e7eb;
    transition: var(--transition);
}

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

.stat-value {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.difficulty-medium {
    color: #d97706;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.review-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.review-toggle {
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
}

.review-content {
    margin-top: 1.25rem;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

.review-item {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.review-question {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-dark);
}

.review-answer {
    color: var(--text-light);
}

.review-answer.incorrect {
    color: var(--incorrect);
}

.score-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.score-actions button {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: 0.875rem 1rem;
}

/* New styles for explanation */
.explanation {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.explanation h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.explanation p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* Score Container Styles */
.score-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background);
}

.results-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 550px;
    padding: 2.5rem;
    text-align: center;
    position: relative;
}

.confetti {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.score-header {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.score-header h2 {
    margin-bottom: 0.5rem;
}

.unit-name {
    color: var(--text-muted);
    font-size: 1rem;
}

#user-score {
    font-size: 2rem;
    font-weight: 700;
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--secondary);
    color: var(--primary-dark);
}

.performance-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat {
    padding: 1rem 0.5rem;
    border-radius: var(--border-radius);
    background-color: #f9fafb;
}

.stat-value {
    font-weight: 700;
    font-size: 1.25rem;
}

.difficulty-medium {
    color: #d69e2e;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.score-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.score-actions button {
    padding: 0.75rem 1.5rem;
}

/* New Course Section Styles */
.course-section {
    background-color: white;
    border-radius: 16px;
    margin-bottom: 3rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
}

.course-header {
    background-color: var(--primary);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.course-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.course-title h3 {
    color: white;
    margin-bottom: 0.25rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.course-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.course-section .unit-cards {
    padding: 1.5rem;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Update quiz header to show course info */
.course-info-display {
    font-size: 0.9rem;
    color: var (--text-muted);
    margin-top: 0.25rem;
}

/* Fix for container-mid visibility issues */
.container-mid {
    width: 100%;
    transition: opacity 0.3s ease;
}

.container-mid.hide {
    display: none !important;
}

/* Responsiveness - UPDATED */
@media screen and (max-width: 1024px) {
    .hero-section .container {
        flex-direction: column;
        text-align: center;
        gap: 3rem;
    }
    
    .search-container {
        margin: 0 auto;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media screen and (max-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }
    
    .container {
        padding: 0 1.5rem;
    }
    
    .navbar {
        padding: 1rem 5%;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .nav-links {
        gap: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .unit-cards {
        grid-template-columns: 1fr;
    }
    
    #display-container {
        width: 92%;
        margin: 1rem auto;
    }
    
    .quiz-header {
        padding: 0.75rem 1rem;
    }
    
    .quiz-content {
        padding: 1.25rem 1rem;
        max-height: 55vh;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .quiz-footer {
        padding: 0.75rem 1rem;
    }
    
    .quiz-footer button {
        width: 100%;
    }
    
    .performance-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .score-actions {
        flex-direction: column;
    }
    
    .course-header {
        padding: 1rem;
    }
    
    .course-section .unit-cards {
        padding: 1rem;
    }
    
    body {
        overflow-x: hidden;
    }
    
    .option-div {
        padding: 1.25rem 1rem;  /* Increase tap target size for mobile */
    }
    
    .quiz-content {
        padding: 1.5rem;
        max-height: 60vh;
    }
    
    .quiz-actions {
        padding: 0 1.5rem;
    }
    
    .hint-bubble {
        width: 250px;
    }
    
    .question-nav {
        gap: 0.5rem;
    }
    
    .quiz-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .quiz-controls #end-button {
        width: 100%;
    }
    
    .question-nav {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }
    
    .results-card {
        padding: 2rem 1.5rem;
    }
    
    .performance-stats {
        grid-template-columns: 1fr;
    }
    
    .score-actions {
        flex-direction: column;
    }
    
    .score-actions button {
        width: 100%;
        max-width: none;
    }
    
    .quiz-controls {
        justify-content: center;
        gap: 0.8rem;
    }
    
    .question-nav {
        gap: 0.75rem;
        justify-content: center;
        order: 1;
        width: 100%;
    }
    
    #end-button {
        order: 2;
    }
    
    .btn-primary, .btn-secondary, .btn-outline, #end-button {
        padding: 0.6rem 1.1rem;
    }
}

@media screen and (max-width: 480px) {
    .nav-links {
        display: none;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .hero-section {
        padding: 3rem 0;
    }
    
    .quiz-content {
        max-height: 50vh;
    }
    
    .question-dots {
        max-width: 180px;
    }
    
    .hint-bubble {
        width: 200px;
        font-size: 0.8rem;
        padding: 0.7rem;
    }
    
    .option-div {
        margin-bottom: 0.6rem;
    }
    
    .explanation {
        padding: 0.75rem;
    }
    
    .explanation h4 {
        font-size: 0.85rem;
    }
    
    .explanation p {
        font-size: 0.8rem;
    }
    
    .results-card {
        padding: 1.5rem 1rem;
    }
    
    .score-header h2 {
        font-size: 1.5rem;
    }
    
    #user-score {
        font-size: 1.35rem;
        padding: 0.8rem;
    }
    
    .score-actions button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    #display-container {
        width: 96%;
        margin: 0.75rem auto;
        border-radius: 10px;
    }
    
    .quiz-header {
        padding: 1rem;
    }
    
    .timer-div {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .quiz-content {
        padding: 1.25rem 1rem;
        max-height: 55vh;
    }
    
    .option-div {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .quiz-footer {
        padding: 0.75rem 1rem;
    }
    
    .explanation {
        padding: 1rem;
        margin-top: 1.25rem;
    }
    
    .btn-primary, .btn-secondary, .btn-outline, #end-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .dot {
        width: 8px;
        height: 8px;
    }
    
    .quiz-controls {
        flex-direction: column-reverse;
        align-items: center;
    }
    
    .question-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-primary, .btn-secondary, .btn-outline, #end-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        min-width: 110px;
        justify-content: center;
    }
    
    #end-button {
        margin-bottom: 0.5rem;
        width: 100%;
    }
}

/* New - Mobile-optimized portrait mode */
@media screen and (max-height: 700px) and (max-width: 480px) {
    .quiz-content {
        max-height: 45vh;
        padding: 1rem;
    }
    
    .option-div {
        padding: 0.8rem;
        margin-bottom: 0.65rem;
    }
    
    .question {
        margin-bottom: 1.25rem;
        font-size: 1rem;
        padding-left: 1rem;
    }
    
    .quiz-footer {
        padding: 0.75rem 1rem;
    }
    
    .btn-primary, .btn-secondary, #end-button {
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
    }
}

/* New - Landscape mode optimization for mobile devices */
@media screen and (max-height: 500px) {
    .quiz-header {
        padding: 0.75rem 1.25rem;
    }
    
    .quiz-content {
        max-height: 70vh;
        padding: 1rem 1.25rem;
    }
    
    #display-container {
        margin: 0.5rem auto;
    }
}

/* Style for code blocks in questions */
.code-block {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre;
    max-width: 100%;
}

/* Ensure buttons have proper :focus states for accessibility */
button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Fix for hidden elements to ensure they don't affect layout */
.hide {
    display: none !important;
    visibility: hidden;
    height: 0;
    width: 0;
    position: absolute;
    overflow: hidden;
}