@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

:root {
    --ql2-primary: #6366f1;
    --ql2-secondary: #4f46e5;
    --ql2-accent: #f59e0b;
    --ql2-bg: #f8fafc;
    --ql2-card-bg: #ffffff;
    --ql2-text-main: #1e293b;
    --ql2-text-muted: #64748b;
    --ql2-radius: 16px;
    --ql2-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --ql2-shadow-hover: 0 10px 40px -4px rgba(0, 0, 0, 0.1);
}

.ql2-wrapper {
    font-family: 'Outfit', sans-serif;
    color: var(--ql2-text-main);
    background-color: var(--ql2-bg);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* LINE 1: BREADCRUMB */
.ql2-breadcrumb-nav {
    background: white;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.ql2-breadcrumb {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
}

.ql2-breadcrumb li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ql2-text-muted);
}

.ql2-breadcrumb a {
    text-decoration: none;
    color: var(--ql2-text-muted);
    transition: color 0.2s;
}

.ql2-breadcrumb a:hover {
    color: var(--ql2-primary);
}

.ql2-breadcrumb a.active {
    color: var(--ql2-text-main);
    font-weight: 600;
}

.ql2-breadcrumb .separator {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* LINE 2: VIGNETTES */
.ql2-vignettes-section {
    background: #f1f5f9;
    padding: 30px 0;
    border-bottom: 1px solid #e2e8f0;
}

.ql2-vignettes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.ql2-vignette-card {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.ql2-vignette-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--ql2-primary);
}

.ql2-vignette-icon {
    width: 40px;
    height: 40px;
    background: color-mix(in srgb, var(--color) 10%, #fff);
    color: var(--color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ql2-vignette-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

.ql2-vignette-info span {
    font-size: 0.8rem;
    color: var(--ql2-text-muted);
}

/* --- AMBITION FUTURE / THEMES EN PREPARATION --- */

/* Par defaut, masquer les rubriques a 0 quiz */
.ql2-vignette-card.is-future {
    display: none;
}

/* Affichage lorsque le mode "ambition future" est actif */
body.show-future-enabled .ql2-vignette-card.is-future,
.ql2-vignettes-section.show-future-active .ql2-vignette-card.is-future {
    display: flex;
}

/* Style distinctif et valorisant pour les cartes a venir */
.ql2-vignette-card.is-future {
    background: #fbfcfe;
    border: 1px dashed #cbd5e1;
    opacity: 0.82;
    transition: all 0.25s ease;
}

.ql2-vignette-card.is-future:hover {
    opacity: 1;
    border-color: #94a3b8;
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ql2-badge-coming-soon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 999px;
    width: fit-content;
}

/* Barre d'outils au dessus de la grille des vignettes */
.ql2-vignettes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.ql2-vignettes-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ql2-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ql2-vignettes-badge-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ql2-primary);
    background: color-mix(in srgb, var(--ql2-primary) 12%, #fff);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Commutateur Switch "Voir l'ambition future" */
.ql2-future-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.ql2-future-switch:hover {
    border-color: var(--ql2-primary);
    background: #fafafa;
}

.ql2-future-switch input {
    display: none;
}

.ql2-future-slider {
    width: 34px;
    height: 18px;
    background-color: #cbd5e1;
    border-radius: 18px;
    position: relative;
    transition: background-color 0.25s;
    flex-shrink: 0;
}

.ql2-future-slider::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ql2-future-switch input:checked + .ql2-future-slider {
    background-color: var(--ql2-primary);
}

.ql2-future-switch input:checked + .ql2-future-slider::before {
    transform: translateX(16px);
}

.ql2-future-switch-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ql2-future-counter {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 700;
}

/* Encart si toutes les sous-rubriques sont vides */
.ql2-vignettes-notice {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #94a3b8;
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ql2-vignettes-notice-icon {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.ql2-vignettes-notice-text {
    flex: 1;
}

.ql2-vignettes-notice-text h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ql2-text-main);
}

.ql2-vignettes-notice-text p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ql2-text-muted);
    line-height: 1.4;
}

.ql2-btn-toggle-future {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ql2-btn-toggle-future:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
    transform: translateY(-1px);
}

/* Dropdown filtre matiere : masquer les matieres sans quiz si mode futur desactive */
body:not(.show-future-enabled) select[name="matiere"] option.opt-future:not(:checked) {
    display: none;
}

/* CATEGORY INFO (for leaf categories) */
.ql2-category-info {
    background: #ffffff;
    padding: 30px 0;
    border-bottom: 1px solid #e2e8f0;
}

.ql2-info-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ql2-info-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.ql2-info-icon {
    width: 45px;
    height: 45px;
    background: color-mix(in srgb, var(--color) 15%, #fff);
    color: var(--color);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color) 20%, transparent);
}

.ql2-info-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ql2-text-main);
}

.ql2-info-description {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.ql2-info-description .description-content {
    flex: 1;
    color: var(--ql2-text-muted);
    line-height: 1.7;
    font-size: 0.95rem;
}

.ql2-audio-btn {
    background: color-mix(in srgb, var(--ql2-primary) 10%, #fff);
    color: var(--ql2-primary);
    border: 1px solid color-mix(in srgb, var(--ql2-primary) 20%, transparent);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.ql2-audio-btn:hover {
    background: color-mix(in srgb, var(--ql2-primary) 20%, #fff);
    transform: scale(1.05);
}

.ql2-audio-btn i {
    font-size: 0.9rem;
}

.ql2-info-resource {
    text-align: center;
}

.ql2-resource-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--ql2-primary) 0%, var(--ql2-secondary) 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.ql2-resource-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* MEMOS SECTION - PREMIUM STYLE */
.ql2-memos-section {
    margin-top: 40px;
    background: #fdfdfd;
    border: 1px solid #eef2f6;
    border-radius: 16px;
    padding: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.ql2-memos-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 20px;
}

.ql2-memos-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ql2-text-main);
    margin-bottom: 8px;
}

.ql2-memos-title i {
    color: var(--ql2-primary);
    background: color-mix(in srgb, var(--ql2-primary) 10%, white);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.ql2-memos-header p {
    color: var(--ql2-text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.ql2-memos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.ql2-memo-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 5px solid var(--accent);
    overflow: hidden;
}

.ql2-memo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.ql2-memo-card.is-expanded {
    grid-column: 1 / -1;
}

.ql2-memo-card-inner {
    padding: 24px;
}

.ql2-memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ql2-memo-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ql2-text-main);
    font-family: 'Outfit', sans-serif;
}

.ql2-memo-actions {
    display: flex;
    gap: 10px;
}

.ql2-memo-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    color: var(--ql2-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ql2-memo-action-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

.ql2-memo-body {
    position: relative;
    max-height: 120px;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.ql2-memo-card.is-expanded .ql2-memo-body {
    max-height: 2000px;
}

.ql2-memo-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to top, white, transparent);
    transition: opacity 0.3s;
}

.ql2-memo-card.is-expanded .ql2-memo-body::after {
    opacity: 0;
    pointer-events: none;
}

.ql2-memo-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #475569;
}

.ql2-memo-text b {
    color: var(--accent);
    font-weight: 700;
}

.ql2-memo-text ul {
    padding-left: 20px;
    margin: 15px 0;
}

.ql2-memo-text li {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .ql2-memos-grid {
        grid-template-columns: 1fr;
    }

    .ql2-memos-section {
        padding: 20px;
    }
}

/* LINE 3: SEARCH & COUNT */
.ql2-hero {
    padding: 25px 0;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.ql2-hero-content {
    max-width: 900px;
    margin: 0 auto;
}

.ql2-search-box {
    background: #f8fafc;
    padding: 5px 5px 5px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ql2-search-box:focus-within {
    border-color: var(--ql2-primary);
    background: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.1);
}

.ql2-search-box i {
    color: var(--ql2-primary);
    font-size: 1.1rem;
}

.ql2-search-box input {
    border: none;
    background: none;
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1rem;
    outline: none;
    color: var(--ql2-text-main);
    font-weight: 500;
}

.ql2-search-box button {
    background: var(--ql2-primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.ql2-search-box button:hover {
    background: var(--ql2-secondary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.ql2-count-info {
    margin-top: 15px;
    font-size: 0.95rem;
    color: var(--ql2-text-muted);
}

.ql2-count-info strong {
    color: var(--ql2-primary);
    font-weight: 700;
}

/* LINE 4: FILTERS STICKY */
.ql2-filters-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ql2-filters-form {
    display: flex;
    gap: 30px;
    align-items: flex-end;
}

.ql2-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.ql2-filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ql2-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ql2-filter-group label i {
    margin-right: 5px;
    color: var(--ql2-primary);
}

.ql2-filter-group select {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--ql2-text-main);
    font-family: inherit;
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: border-color 0.2s;
}

.ql2-filter-group select:focus {
    border-color: var(--ql2-primary);
}

.ql2-reset-filters {
    background: #fee2e2;
    color: #ef4444;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.ql2-reset-filters:hover {
    background: #fecaca;
}

/* CARDS GRID */
.ql2-content {
    padding: 60px 0 100px;
    scroll-margin-top: 100px;
    /* Offset for sticky filters */
}

.ql2-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
    gap: 30px;
    /* Increased gap */
    padding: 20px;
    /* Add padding to prevent badge clipping at edges */
}

.ql2-card {
    background: var(--ql2-card-bg);
    border-radius: var(--ql2-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ql2-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(226, 232, 240, 0.5);
    position: relative;
}

.ql2-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--ql2-shadow-hover);
    border-color: var(--ql2-primary);
}

.ql2-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 10px;
}

.ql2-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.ql2-header-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ql2-admin-subcat {
    font-size: 0.75rem;
    color: var(--ql2-text-muted);
    font-weight: 500;
    padding-left: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.8;
}



.ql2-subject-badge {
    padding: 4px 10px;
    background: color-mix(in srgb, var(--bg) 10%, #fff);
    color: var(--ql2-text-main);
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid color-mix(in srgb, var(--bg) 20%, transparent);
    max-width: 100%;
    min-width: 0;
}

.ql2-subject-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.ql2-subject-badge i {
    color: var(--bg);
    flex-shrink: 0;
}

.ql2-subject-badge.is-admin-clickable,
.ql2-meta-item.is-admin-clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.ql2-subject-badge.is-admin-clickable:hover {
    background: var(--bg);
    color: white;
}

.ql2-subject-badge.is-admin-clickable:hover i {
    color: white;
}

.ql2-meta-item.is-admin-clickable:hover {
    color: var(--ql2-primary);
}

.ql2-type-badge {
    height: 28px;
    width: 28px;
    background: color-mix(in srgb, var(--color) 10%, #fff);
    color: var(--color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid color-mix(in srgb, var(--color) 15%, transparent);
}

.ql2-explanation-badge {
    height: 28px;
    width: 28px;
    background: #ebf8ff;
    color: #3182ce;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid #bee3f8;
}

.ql2-certified-badge {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 36px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    transition: transform 0.3s ease;
}

/* Variante Or (Admin) */
.ql2-certified-badge.is-official {
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
}

.ql2-certified-badge.is-official::before,
.ql2-certified-badge.is-official::after {
    background: #d4af37;
}

/* Variante Argent/Bleu (Profs) */
.ql2-certified-badge.is-community {
    background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
}

.ql2-certified-badge.is-community::before,
.ql2-certified-badge.is-community::after {
    background: #475569;
}

.ql2-certified-badge:hover {
    transform: scale(1.1) rotate(5deg);
}

.ql2-certified-badge i {
    color: #ffffff;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Les rubans de la médaille */
.ql2-certified-badge::before,
.ql2-certified-badge::after {
    content: "";
    position: absolute;
    bottom: -8px;
    width: 10px;
    height: 16px;
    background: #d4af37;
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

.ql2-certified-badge::before {
    left: 4px;
    transform: rotate(15deg);
}

.ql2-certified-badge::after {
    right: 4px;
    transform: rotate(-15deg);
}

@keyframes ql2-shine {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.ql2-played-badge {
    height: 28px;
    width: 28px;
    background: #e6fffa;
    color: #10b981;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid #b2f5ea;
}

.ql2-card-body h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

/* DESCRIPTION TOGGLE */
.ql2-description-container {
    margin-bottom: 20px;
    position: relative;
}

.ql2-description-text {
    font-size: 0.95rem;
    color: var(--ql2-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ql2-description-text.is-expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
}

.ql2-desc-toggle {
    background: none;
    border: none;
    color: var(--ql2-primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    margin-top: 4px;
}

.ql2-desc-toggle:hover {
    text-decoration: underline;
}

.ql2-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.ql2-meta-item {
    font-size: 0.85rem;
    color: var(--ql2-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.ql2-meta-item i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.ql2-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ql2-btn-play {
    background: linear-gradient(135deg, var(--ql2-primary) 0%, var(--ql2-secondary) 100%);
    color: white;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ql2-btn-play:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.ql2-admin-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.ql2-admin-actions a {
    color: var(--ql2-text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.ql2-admin-actions a:hover {
    color: var(--ql2-primary);
    background: #f1f5f9;
}

/* PAGINATION */
.ql2-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.ql2-pagination a,
.ql2-page-nav {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: var(--ql2-text-main);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
    padding: 0 12px;
}

.ql2-pagination a:hover,
.ql2-page-nav:hover {
    border-color: var(--ql2-primary);
    color: var(--ql2-primary);
    transform: translateY(-2px);
}

.ql2-pagination a.active {
    background: var(--ql2-primary);
    color: white;
    border-color: var(--ql2-primary);
}

.ql2-page-nav {
    background: linear-gradient(135deg, var(--ql2-primary) 0%, var(--ql2-secondary) 100%);
    color: white;
    border-color: var(--ql2-primary);
}

.ql2-page-nav:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ql2-page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    color: var(--ql2-text-muted);
    font-weight: 700;
}

.ql2-page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ql2-text-muted);
}

.ql2-page-jump input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ql2-text-main);
    outline: none;
    transition: border-color 0.2s;
}

.ql2-page-jump input:focus {
    border-color: var(--ql2-primary);
    background: white;
}

/* Remove spinner arrows in number input */
.ql2-page-jump input::-webkit-inner-spin-button,
.ql2-page-jump input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ql2-page-jump input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* MODALS */
#answers-modal,
#assign-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.answers-modal-content,
.assign-modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.answers-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ql2-text-muted);
    transition: color 0.2s;
}

.answers-modal-close:hover {
    color: var(--ql2-text-main);
}

.ql2-ans-list,
.ql2-assign-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
}

.ql2-ans-list li {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
    overflow: hidden;
}

.ql2-ans-list img,
.answers-modal-content img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    box-sizing: border-box;
}

#answers-modal mjx-frac,
.answers-modal-content mjx-frac {
    font-size: 1.05em;
}

#answers-modal mjx-container,
.answers-modal-content mjx-container {
    vertical-align: middle !important;
}

.ql2-ans-list .q {
    font-weight: 700;
    color: var(--ql2-text-main);
    margin-bottom: 5px;
}

.ql2-ans-list .a {
    color: #10b981;
    font-weight: 500;
}

.ql2-assign-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
}

.ql2-assign-list li.disabled {
    opacity: 0.5;
    background: #f1f5f9;
}

.ql2-assign-list label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.ql2-assign-list label span {
    float: right;
    color: var(--ql2-text-muted);
    font-size: 0.8rem;
}

#assign-feedback {
    margin-top: 15px;
    font-weight: 600;
    text-align: center;
}

/* BBCODE STYLES FOR MODAL */
.bbcode-bold {
    font-weight: bold;
}

.bbcode-italic {
    font-style: italic;
}

.bbcode-underline {
    text-decoration: underline;
}

.bbcode-highlight {
    background-color: #ffeb3b;
    padding: 2px 4px;
}

.bbcode-cursive {
    font-family: 'Brush Script MT', cursive;
}

.bbcode-dyslexic {
    font-family: 'OpenDyslexic', Arial, sans-serif;
}

/* LOADER */
.ql2-loader {
    text-align: center;
    padding: 40px;
    color: var(--ql2-primary);
    font-size: 1.1rem;
}

.ql2-loader i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* EMPTY STATE */
.ql2-empty {
    text-align: center;
    padding: 60px 0;
}

.ql2-empty h2 {
    font-weight: 800;
    margin-top: 20px;
}

.ql2-empty img {
    max-width: 350px;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .ql2-filters-form {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .ql2-vignettes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .ql2-filters-sticky {
        padding: 8px 0;
    }

    .ql2-filters-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        align-items: stretch;
    }

    .ql2-filter-group {
        gap: 4px;
        min-width: 0;
    }

    .ql2-filter-group label {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .ql2-filter-group select {
        padding: 8px 10px;
        font-size: 0.85rem;
        height: 40px;
    }

    .ql2-reset-filters {
        grid-column: span 2;
        padding: 8px;
        justify-content: center;
        font-size: 0.85rem;
    }

    .ql2-hero {
        padding: 30px 0;
    }

    .ql2-search-box {
        padding: 4px 4px 4px 12px;
        border-radius: 12px;
    }

    .ql2-search-box input {
        padding: 10px 8px;
        font-size: 0.95rem;
    }

    .ql2-search-box button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .ql2-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ql2-hero-content h1 {
        font-size: 1.8rem;
    }

    .ql2-search-box {
        padding: 3px;
        border-radius: 12px;
        flex-wrap: nowrap;
    }

    .ql2-search-box i {
        display: none;
        /* Save space on very small screens */
    }

    .ql2-search-box input {
        padding: 8px 8px;
        font-size: 0.9rem;
        min-width: 0;
        /* Critical for flex stability */
    }

    .ql2-search-box button {
        padding: 8px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .ql2-count-info {
        font-size: 0.85rem;
    }
}

/* MODAL SYSTEM (Generic) */
.ql2-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ql2-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: none;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.ql2-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.ql2-modal-close:hover {
    color: var(--ql2-text-main);
}

#quick-cat-container {
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 10px;
}

.quick-cat-desc {
    margin-bottom: 15px;
    color: var(--ql2-text-muted);
}

.ql2-selection-tree {
    border-left: 2px solid #eef2f6;
    margin-left: 5px;
}

.ql2-selection-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ql2-selection-label:hover {
    background: #f1f5f9;
}

.ql2-selection-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--ql2-primary);
}

.ql2-modal-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}