/* Question Bank Filtration System - Matches main.css design system */

/* ========== WRAPPER & LAYOUT ========== */
.qb-wrapper {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.qb-header {
    margin-bottom: 2rem;
}

.qb-header .section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.qb-header .section-subtitle {
    color: var(--text-light);
    font-size: 1rem;
}

.qb-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.qb-overview-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.qb-overview-card.primary {
    border-top: 4px solid var(--primary-color);
}

.qb-overview-card.accent {
    border-top: 4px solid #059669;
}

.overview-label {
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.qb-overview-card strong {
    font-size: 1.6rem;
    color: var(--text-dark);
}

.qb-overview-card p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.92rem;
}

/* Mobile Toggle Button */
.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all var(--transition-normal);
}

.mobile-filter-toggle:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Main Grid */
.qb-main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

/* ========== SIDEBAR & FILTERS ========== */
.qb-sidebar {
    position: sticky;
    top: 20px;
}

.filter-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Scrollbar */
.filter-card::-webkit-scrollbar {
    width: 6px;
}

.filter-card::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 10px;
}

.filter-card::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.filter-card::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.filter-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.filter-header i {
    margin-right: 8px;
    color: var(--primary-color);
}

.reset-link {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.reset-link:hover {
    opacity: 0.7;
}

.reset-link i {
    margin-right: 4px;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.filter-label i {
    margin-right: 6px;
    color: var(--text-light);
    width: 16px;
}

.filter-label-sm {
    display: block;
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.filter-label-sm i {
    margin-right: 4px;
    color: var(--text-light);
}

/* Filter Input */
.filter-input,
.filter-input-sm,
.filter-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.filter-input:focus,
.filter-input-sm:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-input-sm {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-options.scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-options.scrollable::-webkit-scrollbar {
    width: 4px;
}

.filter-options.scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.checkbox-label:hover {
    background-color: var(--bg-light);
    border-radius: 4px;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-dark);
}

.filter-badge {
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* Radio Label */
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    user-select: none;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

.radio-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-dark);
}

/* Year Range */
.year-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-range .filter-input-sm {
    flex: 1;
}

.range-separator {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Inline Checkboxes */
.inline-checks {
    display: flex;
    gap: 0.75rem;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
}

.inline-check input[type="checkbox"] {
    cursor: pointer;
}

.inline-check span {
    font-size: 0.875rem;
    color: var(--text-dark);
}

/* Collapse Toggle */
.collapse-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.collapse-toggle:hover {
    color: var(--primary-color);
}

.toggle-icon {
    transition: transform var(--transition-normal);
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.collapsible-section {
    display: none;
    margin-top: 1rem;
}

.filter-subgroup {
    margin-bottom: 1rem;
}

.filter-subgroup:last-child {
    margin-bottom: 0;
}

/* Apply Button */
.btn-apply {
    width: 100%;
    margin-top: 0.5rem;
}

.btn-modern {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-modern:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-modern:active {
    transform: translateY(0);
}

/* ========== CONTENT AREA ========== */
.qb-content {
    min-width: 0;
}

/* Results Bar */
.results-bar {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.active-filters-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.active-filters-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.clear-filters-link {
    color: var(--danger-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.active-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.active-filter-chip {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.results-info {
    font-size: 1rem;
    color: var(--text-dark);
}

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

.results-range {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.results-controls {
    display: flex;
    gap: 0.75rem;
}

.control-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Questions Grid */
.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Question Item */
.question-item {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.question-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.question-item.image-missing {
    border-left-color: #f59e0b;
}

.question-item.image-ready {
    border-left-color: #10b981;
}

/* Question Header Bar */
.question-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.question-num {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
}

.question-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.question-badges > span {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-subject {
    background: var(--primary-color);
    color: white;
}

.badge-difficulty {
    color: white;
}

.badge-difficulty.badge-easy {
    background: var(--secondary-color);
}

.badge-difficulty.badge-medium {
    background: #f59e0b;
}

.badge-difficulty.badge-hard {
    background: var(--danger-color);
}

.badge-marks {
    background: var(--bg-light);
    color: var(--text-dark);
}

.badge-pyq {
    background: #8b5cf6;
    color: white;
}

.badge-image-health {
    color: white;
}

.badge-image-ready {
    background: #059669;
}

.badge-image-missing {
    background: #c2410c;
}

.image-health-note {
    margin: 0.75rem 0 0;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px dashed #fdba74;
    color: #9a3412;
    font-size: 0.875rem;
    font-weight: 500;
}

.question-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.95rem;
}

.meta-pill {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.28rem 0.72rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.meta-pill-good {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.meta-pill-alert {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

/* Question Text */
.question-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Question Image */
.question-img {
    margin: 1rem 0;
    text-align: center;
}

.question-img img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Question Options */
.question-options {
    margin: 1.5rem 0;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
}

.option-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    color: var(--text-dark);
    transition: all var(--transition-fast);
}

.option-item:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.option-item:last-child {
    margin-bottom: 0;
}

/* Question Actions */
.question-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-dark);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.btn-answer {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.btn-answer:hover {
    background: var(--secondary-color);
    color: white;
}

.btn-bookmark {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-bookmark:hover {
    background: var(--primary-color);
    color: white;
}

/* Question Answer (Hidden) */
.question-answer {
    margin-top: 1rem;
    padding: 1rem;
    background: #ecfdf5;
    border-left: 4px solid var(--secondary-color);
    border-radius: 6px;
}

.correct-ans {
    font-weight: 600;
    color: #065f46;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.ans-text {
    color: var(--secondary-color);
    font-size: 1.125rem;
}

.explanation-box {
    color: #065f46;
    font-size: 0.875rem;
    line-height: 1.6;
}

.explanation-box strong {
    display: block;
    margin-bottom: 0.5rem;
}

.explanation-box p {
    margin: 0;
}

/* Empty State */
.empty-state {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-light);
    opacity: 0.3;
    margin-bottom: 1.5rem;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .qb-main {
        grid-template-columns: 260px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: block;
    }

    .qb-overview-grid {
        grid-template-columns: 1fr 1fr;
    }

    .qb-main {
        grid-template-columns: 1fr;
    }

    .qb-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 300px;
        z-index: 1050;
        background: var(--bg-white);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
        transition: left var(--transition-normal);
    }

    .qb-sidebar.active {
        left: 0;
    }

    .filter-card {
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }

    .results-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .active-filters-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-controls {
        width: 100%;
    }

    .control-select {
        flex: 1;
    }

    .question-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .question-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .qb-wrapper {
        padding: 1rem 0.5rem;
    }

    .qb-overview-grid {
        grid-template-columns: 1fr;
    }

    .qb-header .section-title {
        font-size: 1.5rem;
    }

    .question-item {
        padding: 1rem;
    }

    .question-text {
        font-size: 0.9375rem;
    }

    .option-item {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .qb-sidebar {
        width: 100%;
    }

    .empty-state {
        padding: 3rem 1rem;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .qb-sidebar,
    .mobile-filter-toggle,
    .results-bar,
    .question-actions,
    .pagination-wrapper {
        display: none !important;
    }

    .question-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 1rem;
    }

    .question-answer {
        display: block !important;
    }
}
