/* Fix for sticky navbar - CRITICAL CHANGES */
html, body { 
    overflow-x: hidden; 
    overflow-y: auto; /* Add this - ensure vertical scroll works */
    height: 100%; 
    width: 100%; 
    max-width: 100vw; 
    margin: 0;
} 

#root { 
    min-height: 100vh;
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden; /* Move overflow-x here instead */
    overflow-y: visible; /* IMPORTANT: Allow vertical overflow */
} 

.app-layout-wrapper { 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    position: relative;
    overflow-x: hidden;
    overflow-y: visible; /* CRITICAL: Don't hide vertical overflow */
} 

.app-main-content-area { 
    flex: 1 0 auto; 
    width: 100%; 
    display: flex; 
    flex-direction: column;
    overflow-x: hidden;
    /* Remove any overflow-y: hidden if present */
} 

.app-main-content-area > * {
    margin-bottom: 0; 
} 

@media (max-width: 768px) { 
    .app-main-content-area { 
        padding: 0; 
    } 
} 

@media screen and (min-width: 1px) { 
    .app-layout-wrapper { 
        min-height: 100vh; 
    } 
    
    .app-main-content-area { 
        min-height: calc(100vh - 80px); 
    } 
} 

html { 
    overflow-x: hidden; 
} 

body { 
    overflow-x: hidden; 
    position: relative; 

}

[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --nav-bg: #ffffff;
    --nav-border: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --hover-glow: rgba(102, 126, 234, 0.4);
    --text-primary: #1a1a1a;
    --border-color: #dcdcdc;
    --about-btn: #efefef;
    --navbar-bg-light: rgba(255, 255, 255, 0.95);
}

/* DARK */
[data-theme="dark"] {
    --bg-color: #212121;
    --text-color: #ffffff;
    --nav-bg: #212121;
    --nav-border: rgba(255, 255, 255, 0.2);
    --card-bg: #212121;
    --about-btn: #5e575750;
    --navbar-bg-light: #212121;
    --card-header: #60ccec;
    --text-primary: #ffffff;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    transition: 0.25s ease;
}

[data-theme="light"] {
    /* THEME */
    --bottom-theme: linear-gradient(135deg, #621c9f, #2a0248, #621c9f);

    /* Colors */
    --primary-gradient: linear-gradient(135deg, #621c9f, #2a0248, #621c9f);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    --success-color: #38a169;
    --error-color: #e53e3e;

    /* Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-light: rgba(248, 243, 243, 0.95);

    --text-primary: #000000;
    --filter-dropdwon: #050208;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --dark-text: #120e17;
    --light-text: #232224;

    --border-color: #e5e7eb;
    --hover-bg: #f3f4f6;

    --card-bg: rgba(255, 255, 255, 0.9);
    --navbar-bg: rgba(255, 255, 255, 0.95);

    --input-bg: #ffffff;
    --input-border: #d1d5db;

    --navbar-text: #1a202c;
    --navbar-text-secondary: #4b5563;

    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.15);

    /* Layout */
    --border-radius: 15px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --navbar-height: 80px;
    --container-padding: clamp(10px, 3vw, 30px);
    --home-header: #000000;
    --back-link: #821df0;
    --card-header: #821df0;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
    font-size: clamp(14px, 2vw, 16px);
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
}

.quiz-progress span{
    color: var(--text-color);
}

.quiz-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: -2px;
    padding: 7px 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    color: var(--dark-text) !important;
    font-weight: 600;
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.category-page-header {
    text-align: center;
    padding: clamp(20px, 5vw, 20px) 0;
}

.category-page-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: clamp(15px, 3vw, 25px);

    background: linear-gradient(90deg, #6C6FD6, #7B61FF, #6C6FD6);
    background-size: 200% auto;
    
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    animation: gradientMove 4s linear infinite;
}

.category-page-header h2 {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-primary-info); /* fallback added */
    max-width: 1900px;
    margin: -20px auto;
    line-height: 1.7;
    font-weight: 700;
}

@keyframes gradientMove {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.main-content {
    flex: 1;
    display: flex;
    padding: var(--container-padding);
    min-height: calc(100vh - var(--navbar-height) - 70px);
}

.container {
    backdrop-filter: blur(20px);
    padding: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.content-container {
    backdrop-filter: blur(20px);
    padding: clamp(15px, 3vw, 30px);
    width: 100%;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    color: var(--text-primary);
    flex: 1;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
}

.page-title {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    margin-bottom: clamp(15px, 3vw, 25px);
    text-align: center;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.page-description {
    color: var(--bg-color);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-align: center;
    margin-bottom: clamp(25px, 5vw, 40px);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   QUIZ CARDS 
   ========================================== */

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: clamp(18px, 3vw, 32px);
    margin: 20px 30px;
}

/* Remove underline effect */
.whole-card {
    text-decoration: none;
}

/* Main Card */
.quiz-card {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--card-shadow);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;

    display: flex;
    flex-direction: column;
    height: 100%;

    /* Glass-light effect */
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.quiz-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--card-shadow-hover);
}

/* Image Section */
.quiz-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transition:
        opacity 0.3s ease,
        transform 0.35s ease;
    max-width: 100%;
    height: auto;
}

.quiz-card-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 378 / 212;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    max-width: 100%;
}

.quiz-card-image-container::before {
    content: "";
    display: block;
    padding-top: 56.35%;
    width: 100%;
}

.quiz-card-image-container > img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quiz-card:hover .quiz-card-image {
    transform: scale(1.08);
    will-change: transform;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .quiz-card-image {
        image-rendering: auto;
    }
}

/* Fallback Image */
.quiz-card-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--primary-gradient);
    color: white;
    font-size: clamp(2rem, 5vw, 3rem);
}

/* Content */
.quiz-card-content {
    padding: clamp(16px, 3vw, 26px);
    flex: 1;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-primary);
}

/* Title */
.quiz-card-title {
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    color: var(--text-color);
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.35;
}

/* Description */
.quiz-card-desc {
    color: var(--text-color);
    flex: 1;
    max-height: 100%;
    height: 80px;

    margin-bottom: 15px;
    font-size: clamp(0.92rem, 2vw, 1rem);
    line-height: 1.45;

    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stats Section */
.quiz-card-stats {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    margin-top: 10px;

    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);

    gap: 10px;
}

.quiz-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    color: var(--text-secondary);
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
}

.quiz-card:hover .quiz-stat {
    transform: scale(1.12);
}

/* 
==========================================
    BUTTONS
========================================== */

/* Main Button */
.btn {
    display: inline-block;
    background: var(--bottom-theme);
    color: white;
    text-decoration: none;

    padding: clamp(12px, 2vw, 14px) clamp(18px, 3vw, 22px);
    border-radius: 10px;

    font-weight: 600;
    text-align: center;
    font-size: clamp(0.92rem, 2vw, 1.05rem);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        opacity 0.25s ease;

    /* Smooth Shadow */
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);

    /* Glass-touch */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    cursor: pointer;
}

/* Hover Glow */
.btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.38);
    opacity: 0.98;
}

/* Click Effect */
.btn:active {
    transform: scale(0.97);
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.25);
    opacity: 0.85;
}


/* Premium Breadcrumb Styles with Multi-level Navigation */
.breadcrumb {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.2rem 1.5rem;
    margin: 0 0 2rem 0;
    background: var(--bg-color);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
}

.breadcrumb::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        #667eea 0%,
        #764ba2 33%,
        #f093fb 66%,
        #667eea 100%
    );
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

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

.breadcrumb::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bg-color);
}

.breadcrumb li {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

/* Back Link Styles - Enhanced for multiple levels */
.breadcrumb li .back-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.15) 0%,
        rgba(118, 75, 162, 0.15) 100%
    );
    border: 1px solid transparent;
}

/* First Level - Home */
.breadcrumb li:first-child .back-link::before {
    content: "🏠";
    font-size: 1.1rem;
    transition: all 0.3s ease;
    filter: grayscale(0.3);
}

/* Second Level - Main Category */
.breadcrumb li:nth-child(3) .back-link::before {
    content: "📑";
    font-size: 1.1rem;
    transition: all 0.3s ease;
    filter: grayscale(0.3);
}

.breadcrumb li .back-link::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    transition: left 0.5s ease;
}

.breadcrumb li .back-link:hover {
    color: var(--text-color);
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.15) 0%,
        rgba(118, 75, 162, 0.15) 100%
    );
    border: 1px solid rgba(102, 126, 234, 0.3);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

.breadcrumb li .back-link:hover::before {
    transform: scale(1.3) rotate(-10deg);
    filter: grayscale(0) brightness(1.2);
}

.breadcrumb li .back-link:hover::after {
    left: 100%;
}

.breadcrumb li .back-link:active {
    transform: translateY(-1px) scale(1.02);
}

/* Separator Arrow Styles */
.breadcrumb li[aria-hidden="true"] {
    color: var(--text-color);
    font-size: 2rem;
    opacity: 0.6;
    margin: 0 0.3rem;
    user-select: none;
    font-weight: 300;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: arrowPulse 2s ease-in-out infinite;
    position: relative;
}

@keyframes arrowPulse {
    0%,
    100% {
        opacity: 0.8;
        transform: scale(1) translateX(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) translateX(2px);
    }
}

/* Current Page Styles - Enhanced */
.breadcrumb li[aria-current="page"] .current {
    color: var(--text-color);
    font-weight: 800;
    padding: 0.5rem 1.2rem;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.2) 0%,
        rgba(118, 75, 162, 0.2) 100%
    );
    border-radius: 10px;
    border: 2px solid rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.breadcrumb li[aria-current="page"] .current::before {
    content: "📄";
    font-size: 1.1rem;
    animation: iconBounce 2.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes iconBounce {
    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-4px) rotate(-5deg);
    }
    75% {
        transform: translateY(-2px) rotate(5deg);
    }
}

/* Hover effect on entire breadcrumb */
.breadcrumb:hover {
    box-shadow:
        0 12px 40px rgba(31, 38, 135, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Dark Mode Adjustments */
[data-theme="dark"] .breadcrumb {
    background: linear-gradient(
        135deg,
        rgba(30, 30, 30, 0.95) 0%,
        rgba(20, 20, 20, 0.9) 100%
    );
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .breadcrumb li .back-link {
    background: rgba(102, 126, 234, 0.1);
    color: var(--history-text-secondary);
}

[data-theme="dark"] .breadcrumb li .back-link:hover {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.25) 0%,
        rgba(118, 75, 162, 0.25) 100%
    );
    border: 1px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .breadcrumb li[aria-current="page"] .current {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.) 0%,
        rgba(118, 75, 162, 0.3) 100%
    );
    border: 2px solid rgba(102, 126, 234, 0.5);
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .breadcrumb {
    background: rgba(102, 126, 234, 0.1);
    color: var(--history-text-secondary);
}

[data-theme="light"] .breadcrumb li .back-link:hover {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.25) 0%,
        rgba(118, 75, 162, 0.25) 100%
    );
    border: 1px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

[data-theme="light"] .breadcrumb li[aria-current="page"] .current {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.3) 0%,
        rgba(118, 75, 162, 0.3) 100%
    );
    border: 2px solid rgba(102, 126, 234, 0.5);
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .breadcrumb {
        padding: 1rem 1.2rem;
        gap: 0.4rem;
        border-radius: 12px;
    }

    .breadcrumb li {
        font-size: 0.85rem;
    }

    .breadcrumb li .back-link {
        padding: 0.4rem 0.8rem;
        gap: 0.4rem;
    }

    .breadcrumb li .back-link::before,
    .breadcrumb li[aria-current="page"] .current::before {
        font-size: 1rem;
    }

    .breadcrumb li[aria-current="page"] .current {
        padding: 0.4rem 0.9rem;
    }

    .breadcrumb li[aria-hidden="true"] {
        font-size: 1.5rem;
        margin: 0 0.2rem;
    }
}

@media (max-width: 480px) {
    .breadcrumb {
        padding: 0.7rem 0.9rem;
        border-radius: 10px;
        gap: 0.3rem;
    }

    .breadcrumb li {
        font-size: 0.6rem;
    }

    .breadcrumb li .back-link {
        padding: 0.25rem 0.5rem;
    }

    .breadcrumb li[aria-current="page"] .current {
        padding: 0.25rem 0.6rem;
    }

    .breadcrumb li .back-link::before,
    .breadcrumb li[aria-current="page"] .current::before {
        font-size: 0.95rem;
    }

    .breadcrumb li[aria-hidden="true"] {
        font-size: 0.8rem;
        margin: 0 0.15rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .breadcrumb {
        padding: 0.6rem 0.7rem;
        gap: 0.2rem;
    }

    .breadcrumb li {
        font-size: 0.5rem;
    }

    .breadcrumb li .back-link,
    .breadcrumb li[aria-current="page"] .current {
        padding: 0.28rem 0.45rem;
    }
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
    padding: clamp(12px, 2.5vw, 15px);
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: var(--text-primary);
}

.alert.success {
    background-color: rgba(56, 161, 105, 0.1);
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.alert.error {
    background-color: rgba(229, 62, 62, 0.1);
    border-left: 4px solid var(--error-color);
    color: var(--error-color);
}


/* Icon backgrounds */
.light-bg {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.dark-bg {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

/* ==========================================
        RESPONSIVE DESIGN 
        ========================================== */



/* Large screens (1200px to 1399px) */
@media screen and (min-width: 1200px) and (max-width: 1399px) {
    .quiz-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }

    .filter-dropdown {
        padding: 14px 42px 14px 18px;
        font-size: 16px;
    }
}

/* Desktop (992px to 1199px) */
@media screen and (min-width: 992px) and (max-width: 1199px) {
    .quiz-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media screen and (min-width: 768px) and (max-width: 991px) {
    .quiz-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
        justify-items: center;
    }

    .quiz-card {
        min-height: 350px;
        width: 100%;
        max-width: 400px;
    }

    .quiz-card-image-container {
        height: 180px;
    }
}

/* Mobile Large (600px to 767px) */
@media screen and (min-width: 600px) and (max-width: 767px) {
    .quiz-card-image-container {
        height: 120px;
    }
}
/* ==========================================
        REDUCED MOTION PREFERENCES
        ========================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
        PRINT STYLES
        ========================================== */
@media print {
    .main-content {
        padding: 0;
    }

    .quiz-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    body {
        background: white;
        color: black;
    }
}

/* ==========================================
        ADDITIONAL DARK MODE ENHANCEMENTS
        ========================================== */
@media (prefers-color-scheme: dark) {
    /* Enhanced shadows for dark mode */
    .quiz-card:hover {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    }

    /* Better contrast for buttons in dark mode */
    .btn:hover {
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.5);
    }

    /* Logout button adjustment */
    .logout-btn:hover {
        box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
    }

    /* Input focus states in dark mode */
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    select:focus,
    textarea:focus {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }

    /* Alert adjustments for dark mode */
    .alert.success {
        background-color: rgba(56, 161, 105, 0.2);
    }

    .alert.error {
        background-color: rgba(229, 62, 62, 0.2);
    }

    /* Quiz card category in dark mode */
    .quiz-card-category {
        background: rgb(245, 245, 247);
        color: var(--back-link);
    }

}

/* ==========================================
        SMOOTH SCROLLING
        ========================================== */
html {
    scroll-behavior: smooth;
}

/* ==========================================
        SELECTION COLORS
        ========================================== */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
}

/* ==========================================
        SCROLLBAR STYLING
        ========================================== */
/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #667eea var(--bg-secondary);
}

/* ==========================================
        ACCESSIBILITY ENHANCEMENTS
        ========================================== */
/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ==========================================
        UTILITY CLASSES
        ========================================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ========================================
   Share Button with Category Name Inside
   Integrates with existing global styles
   ======================================== */

/* Wrapper Container */
.quiz-card-category-wrapper {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

/* Share Button - Contains both icon and category name */
.quiz-card-share-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    
    background: #ffffff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    padding: 8px 18px 8px 14px;
    border-radius: 25px;
    
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Remove default button styles */
    outline: none;
    font-family: inherit;
}

/* Share Icon inside button */

/* Category Text inside button */
.quiz-card-category-text {
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}

/* Hover Effect - Entire Button */
.quiz-card-share-icon-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(98, 28, 159, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Icon animation on hover */
.quiz-card-share-icon-btn:hover svg {
    transform: scale(1.2) rotate(10deg);
    color: #ffffff;
}

.quiz-card-share-icon-btn:hover span {
    color: #ffffff;
}

/* Active/Click State */
.quiz-card-share-icon-btn:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 3px 10px rgba(98, 28, 159, 0.3);
}

/* Ripple Effect on Click */
.quiz-card-share-icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 25px;
    background: rgba(98, 28, 159, 0.4);
    transform: scale(0);
    opacity: 0;
    transition: all 0.5s ease;
    pointer-events: none;
}

.quiz-card-share-icon-btn:active::before {
    transform: scale(1);
    opacity: 1;
    transition: all 0s;
}

.quiz-card-share-icon-btn:focus-visible .quiz-card-category-text {
    color: #ffffff;
}

@media (prefers-contrast: high) {
    
    .quiz-card-category-text {
        color: inherit;
    }
}

/*  STRAT QUIZ  */

.quizActionButtons {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: auto;
}

.btnStart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: -10px;
    margin-top: -15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 9px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
    font-size: clamp(0.8rem, 1.6vw, 0.9rem);
    border: none;
    cursor: pointer;
}

.btnStart:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.quizGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

@media (max-width: 768px){
    .quizGrid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.quizGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 2rem;
    max-width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}

@media (max-width: 480px) {
    .quizGrid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 3rem 1rem;
    }
}

@media (min-width: 481px) and (max-width: 600px){
    .quizGrid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 3rem 1rem;
        max-width: 88%;
    }
}

@media (min-width: 601px) and (max-width: 767px) {
    .quizGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 3rem 0.6rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .quizGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 3rem 1.5rem;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .quizGrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
        padding: 3rem 2rem;
    }
}

/* Large Desktops - 1280px to 1599px */
@media (min-width: 1280px) and (max-width: 1599px) {
    .quizGrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
        padding: 3rem 2.5rem;
    }
}

/* Ultra Wide Screens - 1600px and above */
@media (min-width: 1600px) {
    .quizGrid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
        padding: 3rem 3rem;
        max-width: 1800px;
    }
}

html.menu-open,
html.menu-open body {
    overflow: hidden !important;
    height: 100% !important;
}

/* ── Grid ──────────────────────────────────────────────────── */
.hcard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 2rem;
    max-width: 1900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ── Card ───────────────────────────────────────────────────── */
.hcard {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    text-decoration: none;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius, 15px);
    overflow: hidden;
    box-shadow: var(--card-shadow, 0 10px 25px rgba(0,0,0,0.08));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-height: 250px;
}

.hcard:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--card-shadow-hover, 0 15px 35px rgba(0,0,0,0.15));
}

/* ── Image Wrapper ──────────────────────────────────────────── */
.hcard__image-wrap {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hcard__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.hcard:hover .hcard__image {
    transform: scale(1.06);
}

.hcard__image-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: clamp(2rem, 5vw, 3rem);
}

/* ── Content ────────────────────────────────────────────────── */
.hcard__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: clamp(14px, 2.5vw, 22px) clamp(16px, 3vw, 26px);
    gap: 12px;
    min-width: 0;
}

.hcard__top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.hcard__content-top {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hcard__content-bottom {
    margin-top: -40px;
    align-items: end;
}

/* ── Title ──────────────────────────────────────────────────── */
.hcard__title {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.35;
    margin: 0;
    flex: 1;               /* takes remaining space */
    min-width: 0;
    /* Allow wrapping on small screens */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Description ────────────────────────────────────────────── */
.hcard__desc {
    font-size: clamp(0.85rem, 1.6vw, 0.95rem);
    color: var(--text-color);
    line-height: 1.55;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;   /* ✅ enables vertical scroll */
    overflow-x: hidden;
}

.hcard__desc::-webkit-scrollbar {
    width: 3px;
}

.hcard__desc::-webkit-scrollbar-track {
    background: transparent;
}

.hcard__desc::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.45);
    border-radius: 3px;
}

.hcard__desc::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.75);
}

/* ── Action Row ─────────────────────────────────────────────── */
.hcard__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;        /* never shrink — stays on right */
    flex-wrap: nowrap;
}

/* Start Button */
.hcard__btn-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: clamp(0.78rem, 1.6vw, 0.9rem);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    flex: 0 0 auto;       /* don't stretch — sit naturally */
    white-space: nowrap;
    border: none;
    text-align: center;
}

.hcard__btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

/* Progress Badge */
.hcard__progress {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-weight: 600;
    font-size: clamp(0.82rem, 1.6vw, 0.92rem);
    color: var(--text-color);
    white-space: nowrap;
}

/* Share Button */
.hcard__share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: transparent;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.hcard__share-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] .hcard {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hcard:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .hcard__share-btn {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .hcard__progress {
    background: rgba(102, 126, 234, 0.15);
}

@media (max-width: 1023px) {
    .hcard-grid {
        padding: 1.5rem;
    }

    .hcard__top-row {
        gap: 10px;
    }

    .hcard__actions {
        gap: 6px;
    }

    .hcard__image-wrap {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }
}

@media (max-width: 767px) {
    .hcard-grid {
        padding: 2rem 1rem;
        gap: 1rem;
    }
    .hcard__content {
        padding: 12px 14px;
        gap: 8px;
    }
    .hcard__image-wrap {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }

    .hcard__desc {
        font-size: 0.82rem;
        max-height: 140px;  
    }

    .hcard__btn-start {
        padding: 7px 14px;
        font-size: 0.8rem;
    }

    .hcard__progress {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .hcard__share-btn {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 599px) {
    .hcard {
        flex-direction: column;
        min-height: unset;
    }

    .hcard__image-wrap {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: 250px;       
        flex-shrink: 0;
    }

    .hcard__content {
        padding: 12px 14px;
        gap: 8px;
    }

    .hcard__top-row {
        flex-direction: row;         
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .hcard__title {
        font-size: 0.92rem;
        flex: 1;
        -webkit-line-clamp: 2;
        white-space: normal;
    }

    .hcard__actions {
        flex-shrink: 0;
        gap: 6px;
    }

    .hcard__desc {
        font-size: 0.8rem;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 3;        
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-height: unset;
    }

    .hcard__btn-start {
        padding: 6px 12px;
        font-size: 0.78rem;
        gap: 4px;
        white-space: nowrap;
    }

    .hcard__progress {
        padding: 5px 8px;
        font-size: 0.78rem;
        gap: 4px;
        white-space: nowrap;
    }

    .hcard__share-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
}

@media (max-width: 379px) {

    .hcard__image-wrap {
        height: 140px;
    }

    .hcard__content {
        padding: 10px 12px;
    }

    .hcard__title {
        font-size: 0.82rem;
    }

    .hcard__desc {
        font-size: 0.74rem;
        -webkit-line-clamp: 3;
    }

    .hcard__btn-start {
        font-size: 0.72rem;
        padding: 5px 9px;
    }

    .hcard__progress {
        font-size: 0.72rem;
        padding: 4px 6px;
    }

    .hcard__share-btn {
        width: 28px;
        height: 28px;
    }
}

/* ── Accessibility ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .hcard,
    .hcard__image,
    .hcard__btn-start,
    .hcard__share-btn {
        transition: none !important;
        animation: none !important;
    }
}

.hcard:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.hcard__share-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}