/* ==============================================================================
   EduAdvice Question Paper Generator - Stylesheet
   Design System: EduAdvice Corporate (Deep Navy, Slate, Accent Red/Orange)
   ============================================================================== */

:root {
    --primary: #1e3a8a;
    --primary-dark: #0f172a;
    --primary-light: #3b82f6;
    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;
    --accent-orange: #f59e0b;
    --accent-emerald: #10b981;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-heading: 'Raleway', sans-serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.create-paper-ai-portal-wrap * {
    box-sizing: border-box;
}

.create-paper-ai-portal-wrap {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 50px;
}

/* Container - Matches standard EduAdvice Bootstrap margins */
.create-paper-ai-portal-wrap .site-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}
@media (min-width: 768px) {
    .create-paper-ai-portal-wrap .site-container {
        width: 750px;
    }
}
@media (min-width: 992px) {
    .create-paper-ai-portal-wrap .site-container {
        width: 970px;
    }
}
@media (min-width: 1200px) {
    .create-paper-ai-portal-wrap .site-container {
        width: 1170px;
    }
}

/* ==============================================================================
   App Layout (Two-Column Responsive)
   ============================================================================== */
.main-content {
    padding: 10px 0 50px;
}

.app-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.form-column {
    flex: 0 0 460px;
    max-width: 480px;
}

.preview-column {
    flex: 1;
    min-width: 0;
}

@media (max-width: 991px) {
    .app-layout {
        flex-direction: column;
        gap: 20px;
    }
    .form-column {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }
    .preview-column {
        width: 100%;
    }
}

/* ==============================================================================
   Card Containers
   ============================================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Wizard Header */
.card-header-edu {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: white;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 3px solid var(--accent-red);
}

.card-header-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #60a5fa;
    flex-shrink: 0;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.card-subtitle {
    font-size: 12.5px;
    color: #cbd5e1;
    line-height: 1.4;
}

/* Wizard Form Elements */
.wizard-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-label-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.required {
    color: var(--accent-red);
    font-weight: 700;
}

.select-wrapper {
    position: relative;
}

.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 12px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control-sm {
    padding: 7px 12px;
    font-size: 13px;
}

/* ==============================================================================
   Modern Form Controls & Two-Column Grids
   ============================================================================== */
.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.modern-form .form-group {
    margin-bottom: 12px;
}

.modern-form .form-label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Modern Segmented Control for Difficulty */
.segmented-control.difficulty-segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
    border: 1px solid #e2e8f0;
}

.segment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    background: transparent;
    user-select: none;
    margin: 0;
}

.segment-btn input {
    display: none !important;
}

.segment-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}

.segment-btn.selected {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
    font-weight: 700;
}

.segment-btn.diff-easy.selected {
    color: #059669;
    border-color: #6ee7b7;
    background: #ecfdf5;
}

.segment-btn.diff-moderate.selected {
    color: #1e40af;
    border-color: #93c5fd;
    background: #eff6ff;
}

.segment-btn.diff-difficult.selected {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fef2f2;
}

/* ==============================================================================
   Modern, Accessible Chapter Selection
   ============================================================================== */
.chapter-selection-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}

.chapter-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
}

.chapter-quick-actions .field-aux-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 1px 4px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chapter-quick-actions .field-aux-btn:hover {
    color: #1d4ed8;
}

.aux-pipe {
    color: #cbd5e1;
    font-size: 10px;
}

/* Interactive Search & Filter Bar inside Chapter Selector */
.chapter-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    font-size: 12px;
    pointer-events: none;
}

.chapter-search-input {
    width: 100%;
    padding: 7px 95px 7px 30px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    transition: all 0.15s ease;
}

.chapter-search-input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-browse-btn {
    position: absolute;
    right: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.search-browse-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

/* Active Selected Chapters Tags Tray */
.selected-tags-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 56px;
    overflow-y: auto;
    margin-bottom: 2px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e0e7ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    line-height: 1.3;
}

.tag-pill-remove {
    cursor: pointer;
    color: #6366f1;
    font-weight: bold;
    font-size: 12px;
}

.tag-pill-remove:hover {
    color: #dc2626;
}

/* Accessible, Smooth Scrollable Checklist Container */
.inline-chapter-checklist-box.modern-checklist {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 4px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.inline-chapter-checklist-box::-webkit-scrollbar {
    width: 5px;
}

.inline-chapter-checklist-box::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.inline-chapter-checklist-box::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.inline-chapter-checklist-box::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Generous, Clickable Row Target */
.compact-ch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, border-color 0.12s;
    border: 1px solid transparent;
    margin: 0;
    min-height: 33px;
}

.compact-ch-row:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.compact-ch-row.is-selected {
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* Explicitly visible high-contrast checkbox */
.compact-ch-check {
    display: inline-block !important;
    width: 15px;
    height: 15px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.compact-ch-badge {
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
}

.compact-ch-row.is-selected .compact-ch-badge {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #1e3a8a;
}

.compact-ch-title {
    font-size: 12px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.compact-ch-row.is-selected .compact-ch-title {
    color: #0f172a;
    font-weight: 600;
}

/* Compact Question Presets */
.compact-q-presets {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
}

.compact-q-presets .preset-btn {
    flex: 1;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.compact-q-presets .preset-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.compact-q-presets .preset-btn.active {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #1e3a8a;
}

/* Modern Toggle Card */
.toggle-card-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    gap: 10px;
    margin-top: 10px;
}

.toggle-card-modern .toggle-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    display: block;
}

.toggle-card-modern .toggle-sub {
    font-size: 11px;
    color: #64748b;
    display: block;
    margin-top: 1px;
}

/* Instructions Accordion */
.instructions-accordion {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    margin-top: 10px;
}

.instructions-summary {
    padding: 8px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    background: #f8fafc;
}

.instructions-summary:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.instructions-body {
    padding: 8px 12px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

/* Modern Form Action Buttons */
.modern-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-generate-modern {
    flex: 1;
    padding: 11px 16px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-generate-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-clear-modern {
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-clear-modern:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

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

.badge-count {
    background: #e2e8f0;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.toggle-sub {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

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

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ==============================================================================
   Generation Mode Selector Cards
   ============================================================================== */
.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card input {
    display: none;
}

.mode-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.mode-details strong {
    display: block;
    font-size: 13.5px;
    color: var(--text-main);
}

.mode-details small {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
}

.mode-card.active {
    border-color: var(--primary);
    background: rgba(30, 58, 138, 0.04);
}

.mode-card.active .mode-icon {
    background: var(--primary);
    color: white;
}

/* Custom Textarea */
.custom-textarea {
    resize: vertical;
}

.word-counter {
    font-size: 11.5px;
    color: var(--text-muted);
}

.info-tooltip {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #334155;
    font-size: 10.5px;
    text-align: center;
    cursor: help;
    margin-left: 4px;
}

/* ==============================================================================
   Buttons
   ============================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--primary-dark);
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #cbd5e1;
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: #94a3b8;
    color: var(--text-main);
    background: #f8fafc;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-clear {
    width: 100%;
    padding: 10px;
}

.aux-footer {
    text-align: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.aux-link {
    font-size: 12.5px;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

.aux-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ==============================================================================
   Right Column: Preview Panel
   ============================================================================== */
.preview-card {
    padding: 0;
    overflow: hidden;
}

.preview-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    margin-bottom: 4px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-emerald);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.preview-main-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
}

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

.btn-action {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-action-accent {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-action-accent:hover {
    background: var(--primary-dark);
    color: white;
}

/* Internal 25-Cycle Backend Tracking (Hidden from Portal UI) */
.uniqueness-bar,
.session-history-wrapper,
#generateNextUniqueBtn {
    display: none !important;
}

.kpi-item {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.kpi-val {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-heading);
}

.kpi-highlight {
    color: #34d399; /* Emerald */
}

/* ==============================================================================
   SESSION SETS HISTORY STRIP (1-At-A-Time PDF Tracking)
   ============================================================================== */
.session-history-wrapper {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
}

.session-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.history-label {
    font-weight: 700;
    color: var(--text-dark);
}

.history-sub-info {
    color: var(--text-muted);
    font-size: 11px;
}

.session-history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.session-chips-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex: 1;
}

.session-chip {
    background: white;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
}

.session-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.session-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

.session-chip-badge {
    background: rgba(0, 0, 0, 0.08);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
}

.session-chip.active .session-chip-badge {
    background: rgba(255, 255, 255, 0.25);
}

.btn-reset-cycle {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-reset-cycle:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.preview-toggle-bar {
    background: #f1f5f9;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.active-set-indicator strong {
    color: var(--primary);
}

.solution-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ==============================================================================
   A4 PRINTABLE DOCUMENT CONTAINER
   ============================================================================== */
.a4-document-wrapper {
    background: #3e444e; /* Professional dark canvas backdrop */
    padding: 26px 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: auto;
    border-radius: 0 0 10px 10px;
}

/* Empty State Placeholder - Displayed before user clicks Generate */
.empty-paper-placeholder {
    width: 100%;
    max-width: 520px;
    min-height: 520px;
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    margin: 0 auto;
}

.empty-icon-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #2563eb;
    margin-bottom: 18px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.empty-state-desc {
    font-size: 13px;
    color: #64748b;
    max-width: 420px;
    line-height: 1.55;
    margin-bottom: 22px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.btn-generate-empty {
    padding: 11px 24px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 7px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-generate-empty:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.empty-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 26px;
    max-width: 440px;
    width: 100%;
}

.empty-feature-badge {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 7px;
    text-align: left;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.empty-feature-badge i {
    color: #3b82f6;
    font-size: 13px;
}

.a4-page {
    width: 100%;
    max-width: 520px;
    min-height: 735px;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 24px 28px;
    font-family: 'Merriweather', Georgia, serif;
    color: #111827;
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
    transition: all 0.2s ease;
}

/* Exam Document Header */
.exam-header {
    margin-bottom: 12px;
    text-align: center;
}

.exam-title-row {
    text-align: center;
    padding: 2px 0;
    position: relative;
}

.heading-editable-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 95%;
    margin: 0 auto;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1.5px dashed transparent;
    transition: all 0.2s ease;
}

.heading-editable-wrapper:hover {
    border-color: #93c5fd;
    background-color: #f0f7ff;
}

.heading-editable-wrapper:focus-within {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.exam-paper-heading {
    font-family: var(--font-body); /* Open Sans - clean academic font */
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.5px;
    margin: 0;
    text-align: center;
    text-transform: uppercase;
    font-variant-numeric: lining-nums;
    font-feature-settings: 'lnum' 1;
    cursor: text;
    outline: none;
    min-width: 120px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.15s ease;
}

.exam-paper-heading:focus {
    outline: none;
}

/* Font variations for Question Paper Heading */
.exam-paper-heading.font-academic-sans {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

.exam-paper-heading.font-board-serif {
    font-family: 'Merriweather', Georgia, serif !important;
}

.exam-paper-heading.font-display-sans {
    font-family: 'Raleway', sans-serif !important;
}

.exam-paper-heading.font-formal-times {
    font-family: 'Times New Roman', Times, serif !important;
}

.heading-inline-edit-btn {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e3a8a;
    color: #ffffff;
    border: none;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.heading-editable-wrapper:hover .heading-inline-edit-btn {
    opacity: 1;
    visibility: visible;
}

.heading-inline-edit-btn:hover {
    background: #2563eb;
}

/* Heading Configuration Styles in Left Panel */
.heading-config-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.heading-sub-controls {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.font-selector-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.font-select-label {
    font-size: 11.5px;
    color: #475569;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-control-sm {
    height: 34px !important;
    font-size: 12px !important;
    padding: 4px 10px !important;
}

.btn-edit-title {
    background-color: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    font-weight: 600;
}

.btn-edit-title:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.exam-divider-double {
    border: 0;
    border-top: 2.5px double #0f172a;
    margin: 8px 0;
}

.exam-divider-single {
    border: 0;
    border-top: 1px solid #cbd5e1;
    margin: 10px 0;
}

.exam-info-grid.exam-info-3cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 8px;
    font-family: var(--font-body);
    font-size: 10.5px;
    margin: 8px 0;
    align-items: center;
}

.exam-info-3cols > div:nth-child(1) {
    text-align: left;
}

.exam-info-3cols > div:nth-child(2) {
    text-align: center;
}

.exam-info-3cols > div:nth-child(3) {
    text-align: right;
}

.section-marks-badge,
.q-marks,
.q-marks-tag,
.exam-chapter-banner {
    display: none !important;
}

/* Question Inline Diagrams & Geometric Vector Figures */
.q-diagram-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 8px 0 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    max-width: 360px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    page-break-inside: avoid;
}

.q-diagram-svg {
    width: 100%;
    max-width: 320px;
    height: auto;
    display: block;
}

.q-diagram-caption {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    margin-top: 5px;
    text-align: center;
    font-style: italic;
}

/* Question Inline Data Tables */
.q-table-wrap {
    margin: 8px 0 12px;
    overflow-x: auto;
    max-width: 100%;
    page-break-inside: avoid;
}

.q-table-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 4px;
}

.q-data-table {
    width: 100%;
    max-width: 500px;
    border-collapse: collapse;
    font-size: 12px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.q-data-table th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
}

.q-data-table td {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

.field-aux-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.field-aux-btn:hover {
    color: var(--primary-dark);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-right {
    position: absolute;
    right: 12px;
    color: #94a3b8;
    pointer-events: none;
    font-size: 13px;
}

.exam-instructions-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 10px;
    line-height: 1.45;
    margin-top: 8px;
    text-align: left !important;
}

.exam-instructions-box strong {
    display: block;
    text-align: left !important;
    margin-bottom: 2px;
    color: #0f172a;
    font-size: 10.5px;
}

.exam-instructions-box ol {
    margin: 2px 0 0 16px;
    padding: 0;
    text-align: left !important;
}

.exam-instructions-box ol li {
    text-align: left !important;
    margin-bottom: 2px;
}

/* Questions Body */
.questions-body {
    font-size: 11px;
    line-height: 1.55;
}

.section-block {
    margin-bottom: 16px;
    page-break-inside: avoid;
}

.section-header {
    background: #f1f5f9;
    border-left: 3.5px solid #1e3a8a;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.section-marks-badge {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
}

.question-item {
    margin-bottom: 12px;
    page-break-inside: avoid;
}

.q-item-row,
.q-text-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.q-number,
.q-num {
    font-weight: 700;
    font-size: 11px;
    min-width: 24px;
    flex-shrink: 0;
    color: #0f172a;
}

.q-body,
.q-desc {
    flex: 1;
}

.q-text {
    font-size: 11px;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.5;
}

.q-marks-tag {
    float: right;
    font-weight: 700;
    font-size: 10.5px;
    color: #475569;
    margin-left: 8px;
}

.q-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 12px;
    margin: 4px 0 4px 6px;
    font-size: 10.5px;
}

.q-opt {
    display: flex;
    gap: 5px;
    align-items: baseline;
}

.opt-letter {
    font-weight: 700;
    color: #334155;
    flex-shrink: 0;
}

.opt-text {
    color: #334155;
}

/* Screen Truncation & Sample Preview Lock Banner */
body:not(.exporting-pdf) .screen-hidden-q,
body:not(.exporting-pdf) .screen-hidden-section,
body:not(.exporting-pdf) .screen-hidden-solutions {
    display: none !important;
}

body.exporting-pdf .screen-hidden-q,
body.exporting-pdf .screen-hidden-section,
body.exporting-pdf .screen-hidden-solutions {
    display: block !important;
}

body.exporting-pdf .sample-preview-lock-card,
body.exporting-pdf .heading-inline-edit-btn,
body.exporting-pdf #quickEditHeadingBtn {
    display: none !important;
}

.sample-preview-lock-card {
    margin-top: 14px;
    margin-bottom: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1.5px dashed #94a3b8;
    border-radius: 8px;
    padding: 16px 18px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    position: relative;
    overflow: hidden;
}

.sample-preview-lock-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #06b6d4);
}

.sample-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #bae6fd;
    margin-bottom: 8px;
    font-family: var(--font-body);
}

.sample-lock-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.sample-lock-desc {
    font-family: var(--font-body);
    font-size: 10.5px;
    color: #64748b;
    line-height: 1.5;
    max-width: 420px;
    margin: 0 auto 12px;
}

.sample-lock-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sample-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.btn-sample-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
}

.sample-lock-note {
    font-family: var(--font-body);
    font-size: 9.5px;
    color: #94a3b8;
    margin-top: 8px;
    font-weight: 500;
}

/* Solutions Section */
.solutions-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #94a3b8;
    font-family: var(--font-body);
}

.solutions-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.solution-item {
    background: #f8fafc;
    border-left: 3px solid var(--accent-emerald);
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
    border-radius: 0 4px 4px 0;
}

.sol-clean-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.sol-clean-num {
    color: #1e3a8a;
    font-weight: 700;
    min-width: 32px;
    flex-shrink: 0;
    font-size: 12px;
}

.sol-clean-text {
    color: #1e293b;
    font-size: 12px;
    flex: 1;
}

.exam-footer {
    display: none !important;
}

/* ==============================================================================
   CHAPTER SELECTION MODAL
   ============================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-search-box {
    position: relative;
    margin-bottom: 14px;
}

.modal-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
}

.modal-search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: 13.5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
}

.modal-select-all-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.total-ch-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.modal-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
}

.chapter-list-container {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.custom-checkbox:hover {
    background: #f1f5f9;
}

.custom-checkbox input {
    display: inline-block !important;
    width: 15px;
    height: 15px;
    accent-color: #1e3a8a;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.custom-checkbox input + .checkmark {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    background: white;
    transition: all 0.15s;
}

.custom-checkbox input:checked + .checkmark {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.custom-checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 13.5px;
    color: var(--text-main);
    line-height: 1.4;
}

.font-bold {
    font-weight: 700;
}

.modal-other-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 9px 20px;
    font-size: 13.5px;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

.checkbox-label-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ch-badge {
    background: #e2e8f0;
    color: #1e3a8a;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid #cbd5e1;
}

.ch-name-text {
    font-size: 13px;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.3;
}

.pill-ch-badge {
    background: #1e3a8a;
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
}

.pill-ch-title {
    font-size: 12px;
    color: #0f172a;
    font-weight: 600;
}

.exam-chapter-banner {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #1e3a8a;
    padding: 8px 14px;
    font-size: 12px;
    margin: 8px 0 14px;
    border-radius: 4px;
    font-family: var(--font-body);
}

.ch-banner-label {
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.5px;
    margin-right: 6px;
}

.ch-banner-names {
    color: #1e3a8a;
    font-weight: 700;
}

/* ==============================================================================
   Active Subject & Book Status Strip (Form Panel)
   ============================================================================== */
.selection-status-strip {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.strip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.strip-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.strip-class-tag {
    background: #1e3a8a;
    color: white;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.strip-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.strip-field {
    font-size: 12.5px;
    color: #334155;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.strip-field-label {
    color: #64748b;
    font-weight: 600;
    min-width: 62px;
}

.strip-field-val {
    color: #0f172a;
}

.strip-subject-highlight {
    color: #e11d48;
    font-weight: 800;
}

/* Chapter Selection Header Badge & Pill Enhancements */
.ch-selected-badge {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
}

.pill-subject-context {
    font-size: 10px;
    background: #f1f5f9;
    color: #475569;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

/* Real-Time Manual Chapter Feedback */
.manual-chapter-feedback {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
}

.manual-chapter-feedback.valid {
    display: block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.manual-chapter-feedback.warning {
    display: block;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Modal Enhancements */
.modal-subject-highlight {
    color: #e11d48;
    font-weight: 800;
}

.modal-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-filter-chip {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.quick-filter-chip:hover {
    background: #e2e8f0;
    color: var(--primary-dark);
    border-color: #94a3b8;
}

.ch-subject-tag {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
}

.modal-footer-info {
    font-size: 12.5px;
    color: #475569;
    font-weight: 500;
}

.modal-footer-info .count-highlight {
    font-weight: 800;
    color: #e11d48;
}

.modal-footer-btns {
    display: flex;
    gap: 10px;
    align-items: center;
}

#confirmChapterModalBtn,
.modal-footer-btns #confirmChapterModalBtn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: #ffffff !important;
    border: 1px solid #b91c1c !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    padding: 9px 22px !important;
    font-size: 13.5px !important;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

#confirmChapterModalBtn:hover,
.modal-footer-btns #confirmChapterModalBtn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5) !important;
    transform: translateY(-1px) !important;
}

#confirmChapterModalBtn i,
.modal-footer-btns #confirmChapterModalBtn i {
    color: #ffffff !important;
    font-size: 13px !important;
    margin-right: 4px !important;
}

#cancelChapterModalBtn,
.modal-footer-btns #cancelChapterModalBtn {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 9px 20px !important;
    font-size: 13.5px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

#cancelChapterModalBtn:hover,
.modal-footer-btns #cancelChapterModalBtn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

/* Question & Solution Chapter Chips */
.q-chapter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid #cbd5e1;
    margin-right: 6px;
}

.sol-chapter-tag {
    font-size: 11px;
    font-weight: 700;
    color: #1e3a8a;
    background: #e0e7ff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* ==============================================================================
   PRINT STYLESHEET (@media print)
   ============================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin-top: 0mm !important;
        margin-bottom: 0mm !important;
        margin-left: 14mm !important;
        margin-right: 14mm !important;
    }

    /* 1. Global Reset for Clean PDF Output */
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 2. Hide ALL Website UI, Headers, Banners, SEO Content, Footers & Modals */
    #top-bar,
    .top-bar,
    #header,
    .header,
    .main-nav-clearfix,
    .navbar,
    .site-header,
    .page-title,
    .breadcrumb,
    .breadcrumb-section,
    .podcast-hero-banner,
    .create-paper-banner,
    .ai-token-banner-slim,
    .ai-token-banner,
    .ai-pro-banner,
    .form-column,
    .preview-header,
    .uniqueness-bar,
    .sets-carousel-wrapper,
    .preview-toggle-bar,
    .empty-paper-placeholder,
    .cbse-seo-guide-section,
    .footer-premium,
    .ts-footer,
    #footer,
    .copyright-premium,
    .cookie-popup,
    #cookiePopup,
    .ai-modal-overlay,
    #aiProfileModal,
    #aiPricingModal,
    #chapterModal,
    .modal-backdrop,
    .modal,
    .nav-search,
    .search-block,
    .btn-action,
    .btn-sample-download,
    .sample-preview-lock-card,
    .footer-premium,
    .footer-info,
    .footer-bottom,
    .copyright-text,
    .footer-menu-links {
        display: none !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    /* 3. Strip all outer wrapping containers so they take zero print space */
    .body-inner,
    .main-content,
    .block-wrapper,
    .block,
    .category-listing,
    .container,
    .row,
    .col-lg-12,
    .col-md-12,
    .col-sm-12,
    .app-layout,
    .preview-column,
    .preview-card,
    .a4-document-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
    }

    /* 4. A4 Exam Paper Container - Strictly Isolated */
    .a4-page,
    #printableA4Page {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        box-shadow: none !important;
        padding: 8mm 12mm !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: #ffffff !important;
    }

    /* Unhide all questions, sections, and marking scheme in print / PDF download */
    .screen-hidden-q {
        display: block !important;
    }
    .screen-hidden-section {
        display: block !important;
    }
    .screen-hidden-solutions {
        display: block !important;
    }

    /* Print Document Typography */
    .exam-paper-heading {
        font-size: 15pt !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .exam-info-grid.exam-info-3cols {
        font-size: 10pt !important;
        gap: 6px 14px !important;
    }
    .exam-instructions-box {
        font-size: 9.5pt !important;
        padding: 6px 10px !important;
    }
    .questions-body {
        font-size: 10.5pt !important;
        line-height: 1.6 !important;
    }
    .section-header {
        font-size: 11pt !important;
        padding: 4px 8px !important;
        border-left: 3px solid #000 !important;
    }
    .question-item {
        margin-bottom: 14px !important;
        page-break-inside: avoid;
    }
    .q-number, .q-num {
        font-size: 10.5pt !important;
    }
    .q-text {
        font-size: 10.5pt !important;
        line-height: 1.55 !important;
    }
    .q-options-grid {
        font-size: 10pt !important;
        gap: 4px 16px !important;
    }
    .solutions-section {
        margin-top: 24px !important;
        padding-top: 16px !important;
        page-break-before: always;
    }
    .solution-item {
        font-size: 10pt !important;
        page-break-inside: avoid;
        margin-bottom: 8px !important;
        padding: 6px 10px !important;
        background: #f8fafc !important;
        border-left: 3px solid #10b981 !important;
    }
    .sol-clean-row {
        display: flex !important;
        align-items: flex-start !important;
        gap: 6px !important;
        line-height: 1.5 !important;
    }
    .sol-clean-num {
        color: #1e3a8a !important;
        font-weight: 700 !important;
        font-size: 10pt !important;
        min-width: 32px !important;
        flex-shrink: 0 !important;
    }
    .sol-clean-text {
        color: #1e293b !important;
        font-size: 10pt !important;
        flex: 1 !important;
    }
    .section-block {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    .section-header {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    .heading-inline-edit-btn,
    .heading-editable-wrapper:hover,
    #quickEditHeadingBtn,
    #editHeadingFromPreviewBtn {
        display: none !important;
        outline: none !important;
        background: transparent !important;
    }
    .heading-editable-wrapper {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}

/* ==============================================================================
   Mobile & Tablet Responsiveness
   ============================================================================== */
@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }
    .form-column {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .uniqueness-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .uniqueness-bar {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .top-bar-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .header-tagline {
        text-align: center;
    }
    .q-options-grid {
        grid-template-columns: 1fr;
    }
}
