/* ==========================================
        CSS VARIABLES - Light Mode (Default)
        ========================================== */
:root {
    /* Colors */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --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(250, 250, 250, 0.95);

    --text-primary: #f5f0fa;
    --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);
    --navbar-bg-light: rgba(255, 255, 255, 0.95);
    --footer-bg: rgba(34, 34, 34, 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: #7d10f3;
}

/* ==========================================
        DARK MODE - Auto-detect system preference
        ========================================== */
@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Colors */
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --bg-light: rgba(15, 23, 42, 0.95);
        --filter-dropdwon: white;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary: #94a3b8;
        --dark-text: #f1f5f9;
        --light-text: #cbd5e1;

        --border-color: #475569;
        --hover-bg: #1e293b;

        --card-bg: rgba(30, 41, 59, 0.9);
        --navbar-bg: rgba(15, 23, 42, 0.95);
        --navbar-bg-light: rgba(15, 23, 42, 0.95);
        --footer-bg: rgba(15, 23, 42, 0.95);

        --input-bg: #1e293b;
        --input-border: #475569;

        --navbar-text: #f1f5f9;
        --navbar-text-secondary: #cbd5e1;

        --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
        --card-shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.5);
        --home-header: #f2f2f7;
        --back-link: #7422ee;
        --card-header: rgb(187, 151, 241);
    }

    /* Dark mode specific adjustments */
    .filter-dropdown option {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }

    .quiz-card-category-share {
        background: var(--bg-tertiary);
        color: var(--home-header);
        border: 1px solid var(--border-color);
    }

    .quiz-card-category {
        background: var(--bg-tertiary);
        color: var(--home-header);
        border: 1px solid var(--border-color);
    }

    .quiz-stat i {
        color: #a78bfa;
    }

    .nav-menu {
        background: var(--navbar-bg);
    }
}

/* ==========================================
        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-primary);
    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-action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

/* Start Quiz Button */
.btn-start {
    flex: 1;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

/* Share Button */
.share-btn {
    background: #e4e8f8;
    color: #5066dd;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
}

.share-btn:hover {
    background: #5066dd;
    color: #e4e8f8;
    border-color: transparent;
}

/* Mobile view - keep both centered */
@media (max-width: 480px) {
    .quiz-action-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }
    .btn-start,
    .share-btn {
        flex: none;
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* ==========================================
        LOGO STYLES
        ========================================== */
.logo {
    display: inline-block;
    text-decoration: none;
    line-height: 0;
    flex-shrink: 0;
    min-width: auto;
}

.logo img {
    width: 380px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.logo:hover img {
    transform: scale(1.03);
    opacity: 0.9;
}

@media (max-width: 768px) {
    .logo img {
        width: 260px;
    }
}

@media (max-width: 480px) {
    .logo img {
        width: 200px;
    }
}

/* ==========================================
        NAVBAR STYLES
        ========================================== */
.navbar {
    background: var(--navbar-bg-light);
    backdrop-filter: blur(20px);
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--navbar-height);
    border: none;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 var(--container-padding);
    flex-wrap: nowrap;
}

.navbar-container img {
    max-width: 450px;
    max-height: 123px;
    width: 100%;
    height: 100%;
}

.navbar-container img {
    max-width: 450px;
    max-height: 123px;
    width: 100%; /* Changed from 100% */
    height: 100%; /* Changed from 100% */
    object-fit: contain;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: clamp(10px, 2vw, 2px);
    margin: 0;
    padding: 0;
    background: transparent;
}

.nav-item a {
    color: var(--navbar-text);
    text-decoration: none;
    font-weight: 600;
    padding: clamp(8px, 1.5vw, 10px) clamp(10px, 2vw, 15px);
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: clamp(14px, 1.8vw, 16px);
    white-space: nowrap;
}

.nav-item a:hover,
.nav-item a.active {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    border-radius: 12px;
    color: var(--navbar-text);
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-avatar img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile_h6 {
    color: var(--navbar-text);
}
/* Profile Link */
.profile a {
    color: var(--navbar-text);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    padding: clamp(7px, 1vw, 0px) clamp(5px, 1vw, 50px);
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: clamp(14px, 1.8vw, 16px);
    white-space: nowrap;
}

.profile a:hover,
.profile a.active {
    background: var(--primary-gradient);
    color: white;
    border: 1px solid transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Logout Button */
.logout-btn {
    background: var(--danger-gradient);
    color: white !important;
    border: none;
    padding: 15px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: clamp(13px, 1.6vw, 15px);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    background: var(--primary-gradient);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
}

.mobile-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    margin: 2px 0;
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ==========================================
        FILTER DROPDOWN STYLES
        ========================================== */
.category-filter-nav {
    position: relative;
}

.dropdown-arrow {
    position: relative;
    display: inline-block;
}

.filter-dropdown {
    background: var(--navbar-bg-light);
    border: 2px solid var(--input-border);
    color: var(--navbar-text);
    font-weight: 500;
    padding: 12px 40px 12px 16px;
    border-radius: 10px;
    font-size: clamp(14px, 1.8vw, 16px);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 160px;
    box-shadow: var(--shadow);
}

.filter-dropdown:hover {
    background: var(--bg-secondary);
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.filter-dropdown:focus {
    outline: none;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.filter-dropdown.selected {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.filter-dropdown option {
    background: var(--bg-primary);
    color: var(--filter-dropdwon);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
}

.filter-dropdown option:hover,
.filter-dropdown option:checked {
    background: var(--hover-bg);
    color: #667eea;
}

.dropdown-arrow i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.dropdown-arrow:hover i {
    color: #667eea;
}

.filter-dropdown.selected + i {
    color: white;
}

/* ==========================================
        MAIN CONTENT
        ========================================== */
.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(--text-secondary);
    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(15px, 3vw, 30px);
    margin-top: clamp(20px, 4vw, 30px);
}

.whole-card {
    text-decoration: none;
}

.quiz-card {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: auto; /* Changed from 400px to auto */
    height: 100%; /* Makes all cards in grid same height */
}

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

.quiz-card-image-container {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.quiz-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.quiz-card:hover .quiz-card-image {
    transform: scale(1.05);
}

.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);
}

.quiz-card-category-share {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--hover-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 600;
    color: var(--back-link);
    border: 1px solid var(--border-color);
}

.quiz-card-category {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--hover-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 600;
    color: var(--back-link);
    border: 1px solid var(--border-color);
}

.quiz-card-content {
    padding: clamp(15px, 3vw, 25px);
    flex: 1;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

.quiz-card-title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--home-header);
    margin-bottom: 15px;
    font-weight: 600;
}

.quiz-card-desc {
    color: var(--text-secondary);
    flex: 1;
    max-height: 100%;
    height: 80px;
    margin-bottom: 20px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.quiz-card-stats {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.quiz-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

.quiz-stat i {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: #667eea;
}

/* ==========================================
        BUTTONS
        ========================================== */
.start-btn {
    display: flex;
    justify-content: center;
    margin: 0 0 15px 0;
}

.btn {
    display: inline-block;
    background: var(--primary-gradient);
    color: white;
    padding: clamp(10px, 2vw, 12px) clamp(16px, 3vw, 20px);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    width: 80%;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* ==========================================
        BREADCRUMB
        ========================================== */
.breadcrumb {
    font-size: clamp(14px, 2vw, 16px);
    margin: -20px 0px 10px 0;
}

.breadcrumb a {
    text-decoration: none;
    color: var(--card-header);
    font-weight: 500;
    font-size: 20px;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .current {
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 20px;
}

/* ==========================================
        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);
}

/* ==========================================
        FORM ELEMENTS
        ========================================== */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    background-color: var(--bg-secondary);
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ==========================================
        FOOTER
        ========================================== */
.footer {
    background: var(--footer-bg);
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    padding: clamp(15px, 3vw, 20px) var(--container-padding);
    position: relative;
    width: 100%;
    z-index: 1000;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-content > p {
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    margin: 0;
    order: 1;
    flex-shrink: 0;
}

.quiz-link {
    order: 2;
    flex: 1;
    display: flex !important;
    justify-content: center;
}

.quiz-link ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: clamp(10px, 2.5vw, 20px);
    flex-wrap: wrap;
    justify-content: center;
    position: static;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow: visible;
}

.quiz-link .nav-item {
    margin: 0;
    width: auto !important;
}

.quiz-link .nav-item a {
    color: var(--text-primary);
    font-size: clamp(0.75rem, 1.8vw, 0.9rem) !important;
    text-decoration: none;
    transition: color 0.3s ease;
    border-radius: 4px;
    white-space: nowrap;
    display: block;
    background: none !important;
    transform: none !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px 8px !important;
}

.quiz-link .nav-item a:hover {
    color: #667eea !important;
    background: var(--hover-bg) !important;
    transform: none !important;
}

.social-links {
    display: flex;
    justify-content: flex-end;
    gap: clamp(10px, 2.5vw, 15px);
    order: 3;
    flex-shrink: 0;
}

.social-links a {
    color: var(--text-primary);
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: var(--transition);
    padding: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.social-links a:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-3px);
}

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

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

    .filter-dropdown {
        padding: 14px 42px 14px 18px;
        min-width: 180px;
        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;
    }
}

/* Tablet (768px to 991px) */
@media screen and (min-width: 768px) and (max-width: 991px) {
    .quiz-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .navbar-container {
        gap: 15px;
    }

    .navbar-container img {
        max-width: 450px;
    }

    .nav-item a {
        padding: 8px 12px;
    }

    .filter-dropdown {
        padding: 14px 38px 14px 18px;
        font-size: 15px;
        min-width: 140px;
    }
}

/* Mobile (767px and below) */
@media screen and (max-width: 767px) {
    .mobile-toggle {
        display: flex;
        z-index: 1001;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: 100%;
        width: min(280px, 80vw);
        height: 100vh;
        background: var(--navbar-bg);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: calc(var(--navbar-height) + 20px) 30px 30px;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
        /* transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); */
        z-index: 999;
        gap: 10px;
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    }

    .navbar-container img {
        max-width: 450px;
    }

    .nav-item {
        width: 100%;
    }

    .nav-item a {
        width: 100%;
        padding: 15px 20px;
        justify-content: flex-start;
        border-radius: 10px;
        margin: 5px 0;
        font-size: 16px;
    }

    .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;
    }

    .filter-dropdown {
        width: 100%;
        min-width: unset;
        padding: 16px 45px 16px 20px;
        border-radius: 12px;
        margin: 8px 0;
        font-size: 16px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    }

    .dropdown-arrow i {
        right: 16px;
    }

    /* Mobile overlay */
    .nav-menu.active::before {
        content: "";
        position: fixed;
        top: 0;
        left: -100vw;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    /* Footer mobile layout */
    .footer {
        padding: clamp(10px, 2vw, 15px) var(--container-padding);
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        align-items: center;
    }

    .footer-content > p {
        order: 3;
        margin: 0;
        font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    }

    .quiz-link {
        order: 1;
        width: 100%;
        display: flex !important;
    }

    .quiz-link ul {
        justify-content: center !important;
        gap: 8px !important;
        display: flex !important;
        flex-direction: row !important;
        position: static !important;
        background: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        align-items: center !important;
        overflow: visible !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
    }

    .quiz-link .nav-item {
        display: inline-block !important;
        width: auto !important;
        margin: 0 !important;
    }

    .quiz-link .nav-item a {
        padding: 6px 10px !important;
        font-size: clamp(0.7rem, 2.5vw, 0.85rem) !important;
        color: var(--text-primary) !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        transform: none !important;
        margin: 0 !important;
        width: auto !important;
        justify-content: center !important;
    }

    .quiz-link .nav-item a:hover {
        background: var(--hover-bg) !important;
        color: #667eea !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .social-links {
        order: 2;
        justify-content: center;
        width: 100%;
        gap: 10px;
    }

    .social-links a {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}

/* Small Mobile (480px and below) */
@media screen and (max-width: 480px) {
    :root {
        --container-padding: 15px;
    }

    .quiz-card {
        min-height: 320px;
    }

    .navbar-container img {
        max-width: 350px;
    }

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

    .nav-menu {
        width: min(250px, 85vw);
        padding: calc(var(--navbar-height) + 15px) 20px 20px;
    }

    .social-links a {
        width: 35px;
        height: 35px;
    }

    .footer {
        padding: 8px var(--container-padding);
    }

    .footer-content {
        gap: 10px;
    }

    .quiz-link ul {
        flex-wrap: wrap;
        gap: 6px;
    }

    .quiz-link .nav-item a {
        padding: 5px 8px !important;
        font-size: 12px !important;
    }

    .social-links a {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .footer-content > p {
        font-size: 11px;
    }
}

/* Extra Small Mobile (360px and below) */
@media screen and (max-width: 360px) {
    :root {
        --container-padding: 10px;
    }

    .quiz-card {
        min-height: 300px;
    }

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

    .nav-menu {
        width: min(230px, 90vw);
    }
}

/* Landscape orientation adjustments */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .nav-menu {
        padding-top: 60px;
    }

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

/* ==========================================
        HIGH DPI DISPLAYS
        ========================================== */
@media screen and (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ==========================================
        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 {
    .navbar,
    .footer,
    .mobile-toggle,
    .social-links {
        display: none !important;
    }

    .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);
    }

    /* Mobile menu overlay darker */
    .nav-menu.active::before {
        background: rgba(0, 0, 0, 0.7);
    }

    /* 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-share {
        background: rgb(245, 245, 247);
        color: var(--back-link);
    }

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

    /* Footer links better visibility */
    .social-links a {
        background: rgba(255, 255, 255, 0.05);
    }

    .social-links a:hover {
        background: rgba(102, 126, 234, 0.3);
    }
}

/* ==========================================
        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);
}

/* ==========================================
        LOADING STATES (Optional Enhancement)
        ========================================== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
        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;
}

/* Skip to main content link (for accessibility) */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-gradient);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    z-index: 9999;
    border-radius: 0 0 8px 0;
}

.skip-to-main:focus {
    top: 0;
}

/* ==========================================
        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);
    }
}
