@media (max-width: 900px) {
    .row.g-3, .row.g-4 {
        display: block !important;
    }
    .col-md-4, .col-md-6 {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin-bottom: 1.2rem;
    }
    .module-card, .category-card {
        width: 100% !important;
        margin-bottom: 1.2rem;
    }
}
/* Global Styles */
:root {
    --primary-color: #1a237e;
    --secondary-color: #0d47a1;
    --accent-color: #2962ff;
    --success-color: #00c853;
    --warning-color: #ffd600;
    --text-color: #1a237e;
    --light-bg: #f5f7fa;
    --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Practice section styling */
.practice-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
}

.practice-section h2 {
    color: white;
    font-weight: 600;
}

.practice-section p {
    color: rgba(255, 255, 255, 0.9);
}

.format-badges .badge {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 50px;
    margin: 0.2rem;
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 70vh;
    min-height: 500px;
    background-image: url('https://images.unsplash.com/photo-1449965408869-eaa3f722e40d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 2rem;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 2rem;
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-selector .btn {
    margin-left: 10px;
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all var(--transition-speed);
    border-width: 2px;
}

.language-selector .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Module Cards */
.module-card {
    cursor: pointer;
    border: none;
    border-radius: 20px;
    transition: all var(--transition-speed);
    background: white;
    box-shadow: var(--card-shadow);
    height: 100%;
    overflow: hidden;
    /* Mobile touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    min-height: 44px; /* Minimum touch target */
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.module-card .card-body {
    padding: 2.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity var(--transition-speed);
}

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

.module-card i {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    transition: transform var(--transition-speed);
}

.module-card:hover i {
    transform: scale(1.1);
}

.module-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.module-card p {
    color: #666;
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Category Cards */
.category-selection {
    max-width: 800px;
    margin: 0 auto;
}

.category-card {
    cursor: pointer;
    border: none;
    border-radius: 20px;
    transition: all var(--transition-speed);
    background: white;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    text-align: center;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity var(--transition-speed);
}

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

.category-card i {
    color: var(--accent-color);
    margin-bottom: 1rem;
    transition: transform var(--transition-speed);
}

.category-card:hover i {
    transform: scale(1.15);
}

.category-card h4 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.category-card p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.category-card .badge {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

/* Progress Section */
.progress-section {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin-top: 3rem;
}

.progress-section h2 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--light-bg);
    border-radius: 15px;
    min-width: 180px;
    transition: transform var(--transition-speed);
}

.stat-item:hover {
    transform: translateY(-3px);
}

.stat-item i {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.stat-item span {
    display: block;
    font-weight: 500;
}

.stat-item span:first-of-type {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-item span:last-of-type {
    font-size: 1.25rem;
    color: var(--accent-color);
}

/* Quiz Screen */
.quiz-header {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: var(--light-bg);
    flex: 1;
    margin-left: 1rem;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

#question-container {
    background: white;
    padding: 1rem;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 0.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Question Display Optimizations */
.question h3 {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.question img {
    max-width: 160px;
    max-height: 120px;
    margin: 0.25rem auto 0.5rem auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.options {
    margin-top: 0.5rem;
}

.explanation {
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
    font-size: 0.85rem;
    padding-bottom: 0.5rem;
}

.explanation .alert {
    padding: 0.5rem;
    margin-bottom: 0;
}

.quiz-tab-heading h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    position: sticky;
    bottom: 0;
    background: var(--light-bg);
    border-radius: 15px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-controls .btn {
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    font-weight: 500;
    transition: all var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    min-width: 120px;
}

.quiz-controls .btn-primary {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border: none;
}

.quiz-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

/* Results Screen */
#results-screen {
    background: white;
    padding: 1rem;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

/* Results Statistics Layout */
.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.results-stats .stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 12px;
    min-height: auto;
}

.results-stats .stat-item i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.results-stats .stat-item h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.results-stats .stat-item .display-4 {
    font-size: 1.5rem !important;
    font-weight: 600;
    color: var(--accent-color);
}

/* Results Action Buttons */
.results-screen .btn {
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    font-size: 0.8rem;
    border-radius: 15px;
}

.results-screen h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Overall container spacing */
.container {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Ensure quiz fits in viewport */
#quiz-screen {
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

#quiz-screen .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow-y: auto;
    padding-bottom: 2rem; /* Space for footer when scrolled */
}

/* Set selection buttons - Mobile touch optimization */
.set-select-btn {
    min-height: 44px; /* Minimum touch target size for mobile */
    min-width: 120px;
    touch-action: manipulation; /* Disable double-tap zoom on buttons */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1); /* Subtle tap highlight */
    cursor: pointer;
    user-select: none; /* Prevent text selection on tap */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.set-select-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* Enhanced Responsive Design for Mobile */
@media (max-width: 1024px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .category-selection {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    /* Ensure set selection buttons are properly sized on mobile */
    .set-select-btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
        margin: 0.5rem;
        width: auto;
        flex: 0 0 auto;
    }
    
    .set-selection {
        padding: 1rem 0.5rem;
    }
    
    .set-selection .d-flex {
        gap: 0.75rem !important;
    }
}

@media (max-width: 900px) {
    .row.g-3, .row.g-4 {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem !important;
    }
    .col-md-4, .col-md-6 {
        max-width: 100% !important;
        flex: 1 0 100% !important;
        display: flex;
    }
    .module-card, .category-card {
        margin-bottom: 1.5rem;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .hero-section {
        height: 40vh;
        min-height: 180px;
        padding: 0 0.5rem;
    }
    .hero-content {
        padding: 0 0.5rem;
    }
    .language-selector {
        position: static;
        text-align: center;
        margin-bottom: 1rem;
        padding: 1rem 0.5rem;
    }
    .module-card, .category-card {
        padding: 1.2rem 0.5rem;
        min-width: 0;
    }
    .module-card .card-body, .category-card .card-body {
        padding: 1.2rem 0.5rem;
    }
    .module-card h3, .category-card h4 {
        font-size: 1.1rem;
    }
    .module-card p, .category-card p {
        font-size: 0.95rem;
    }
    .module-card i, .category-card i {
        font-size: 2rem !important;
        margin-bottom: 0.5rem;
    }
    .progress-stats {
        flex-direction: column;
        align-items: center;
    }
    .stat-item {
        width: 100%;
        max-width: 300px;
        padding: 1rem 0.5rem;
    }
    .quiz-controls {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1.5rem; /* Extra space before footer on mobile */
    }
    .quiz-controls .btn {
        width: 100%;
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    #question-container {
        padding: 0.5rem;
        padding-bottom: 1.5rem; /* Extra space for explanation on mobile */
        max-height: 60vh;
    }
    .question h3 {
        font-size: 1rem;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }
    .question img {
        max-width: 100px;
        max-height: 70px;
        margin: 0.25rem auto 0.5rem auto;
    }
    .option {
        padding: 8px 10px;
        margin-bottom: 0.25rem;
        font-size: 1rem;
    }
    .option-text {
        font-size: 0.95rem;
    }
    .quiz-tab-heading h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    .quiz-header {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .timer {
        font-size: 1rem;
    }
    .btn-practice-large {
        font-size: 1.2rem;
        padding: 0.7rem 1.2rem;
        border-radius: 10px;
    }
    .btn-results-large {
        font-size: 1.1rem;
        padding: 0.5rem 1.2rem;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 30vh;
        min-height: 100px;
    }
    .module-card, .category-card {
        padding: 0.7rem 0.2rem;
    }
    .module-card .card-body, .category-card .card-body {
        padding: 0.7rem 0.2rem;
    }
    .module-card h3, .category-card h4 {
        font-size: 1rem;
    }
    .module-card p, .category-card p {
        font-size: 0.85rem;
    }
    .module-card i, .category-card i {
        font-size: 1.5rem !important;
    }
    .btn-practice-large, .btn-results-large {
        font-size: 1rem;
        padding: 0.5rem 0.7rem;
        border-radius: 8px;
    }
    .stat-item {
        padding: 0.7rem 0.2rem;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #90caf9;
        --secondary-color: #64b5f6;
        --accent-color: #42a5f5;
        --text-color: #e3f2fd;
        --light-bg: #1a1a1a;
    }

    body {
        background-color: #121212;
    }

    .module-card, .progress-section, .quiz-header, #question-container, #results-screen {
        background: #1e1e1e;
    }

    .stat-item {
        background: #2a2a2a;
    }

    .module-card p {
        color: #b0b0b0;
    }

    .progress {
        background-color: #2a2a2a;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Accessibility */
.btn:focus, .module-card:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Quiz Options */
.option {
    display: flex;
    align-items: flex-start;
    padding: 6px 10px;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    background: var(--light-bg);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.option:hover {
    background: #e9ecef;
}

.option-number {
    font-weight: bold;
    margin-right: 12px;
    min-width: 20px;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.option-text {
    flex: 1;
    padding: 3px 0;
    font-size: 0.95rem;
    line-height: 1.3;
}

.option-text.correct-answer {
    color: #fff;
    background: var(--success-color);
    font-weight: bold;
    border-radius: 6px;
    padding: 6px 12px;
}

.option-text.incorrect-answer {
    color: #fff;
    background: #e53935;
    font-weight: bold;
    border-radius: 6px;
    padding: 6px 12px;
}

/* Dark mode support for options */
@media (prefers-color-scheme: dark) {
    .option {
        background: #34495e;
    }
    
    .option:hover {
        background: #2c3e50;
    }
    
    .option-number {
        color: var(--primary-color);
    }
}

/* Question Count */
.question-count {
    margin-top: 1rem;
    padding: 0.5rem;
    background: var(--light-bg);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    display: inline-block;
}

.question-count i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

/* Dark mode support for question count */
@media (prefers-color-scheme: dark) {
    .question-count {
        background: #34495e;
    }
}

/* Footer Styles */
.footer, .footer-fixed-bottom {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    position: relative;
    width: 100%;
    margin-top: 2rem;
    z-index: 1;
}

.footer p, .footer-fixed-bottom p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 0.75rem 0;
}

/* Enhanced Review Answers Styles */
.review-answers {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.review-item {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    transition: all var(--transition-speed);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.review-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.review-item.correct {
    border-left: 4px solid var(--success-color);
}

.review-item.incorrect {
    border-left: 4px solid #dc3545;
}

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.review-item-header h4 {
    margin: 0;
    flex: 1;
    padding-right: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.review-item-content {
    padding: 0.5rem 0;
}

.user-answer, .correct-answer {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
    font-size: 0.95rem;
}

.user-answer i, .correct-answer i {
    margin-left: 0.5rem;
    font-size: 1rem;
}

.explanation {
    background: rgba(var(--primary-rgb), 0.05);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* Dark mode support for review answers and footer */
@media (prefers-color-scheme: dark) {
    .footer {
        background: linear-gradient(90deg, #1a1a1a, #2a2a2a);
    }

    .review-answers {
        background: #1e1e1e;
    }

    .review-item {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .review-item-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .user-answer, .correct-answer {
        background: rgba(255, 255, 255, 0.05);
    }

    .explanation {
        background: rgba(var(--primary-rgb), 0.1);
    }
}

/* Reset Button Styles */
.btn-danger {
    background: linear-gradient(90deg, #dc3545, #c82333);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(90deg, #c82333, #bd2130);
    color: white;
} 

.btn-practice-large {
    font-size: 2rem;
    padding: 1.25rem 3rem;
    border-radius: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
} 

.btn-results-large {
    font-size: 1.5rem;
    padding: 0.75rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
}

/* Hide shield icon */
.fa-shield-alt {
    display: none !important;
}