/* ========================================================================
   TOPIC BROWSER - Main Navigation & Layout

   NOTE: Component styles have been split out for maintainability:
   - syllabus-card.css: Syllabus selection cards
   - concept-card.css: Question browser cards, question items
   - power-meter.css: Progress rings, meters, star ratings
   - practice-cart.css: Floating practice cart
   ======================================================================== */

/* ========================================================================
   TOPIC ACCORDION
   ======================================================================== */

.topic-accordion {
    border-radius: 12px;
    overflow: hidden;
}

.topic-accordion .accordion-item {
    border: none;
    margin-bottom: 0.75rem;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.topic-accordion .accordion-button {
    padding: 1rem 1.25rem;
    background: white;
    font-weight: 500;
    border-radius: 12px !important;
}

.topic-accordion .accordion-button:not(.collapsed) {
    background: white;
    box-shadow: none;
}

.topic-accordion .accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.topic-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding-right: 1rem;
}

.topic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.topic-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topic-number {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--jmaths-gray-500);
    font-weight: 600;
}

.topic-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

.topic-count {
    background: var(--jmaths-gray-200);
    color: var(--jmaths-gray-600);
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

/* ========================================================================
   SUBTOPIC GRID
   ======================================================================== */

.subtopic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.subtopic-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--jmaths-gray-50);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.subtopic-item:hover {
    background: white;
    border-color: var(--topic-color, var(--color-primary));
    color: var(--topic-color, var(--color-primary));
    text-decoration: none;
    transform: translateX(4px);
}

.subtopic-code {
    font-weight: 600;
    font-size: 0.95rem;
}

.subtopic-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

.subtopic-arrow {
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.subtopic-item:hover .subtopic-arrow {
    opacity: 1;
}

/* ========================================================================
   MATH CONTENT - Prevent inline math from breaking across lines
   ======================================================================== */

.latex-content,
.math-inline,
mjx-container,
.katex,
.MathJax {
    white-space: nowrap;
    display: inline-block;
}

.katex-display,
.MathJax_Display {
    white-space: normal;
    display: block;
}

@media print {
    .latex-content,
    .math-inline,
    mjx-container,
    .katex {
        white-space: nowrap;
        display: inline-block;
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ========================================================================
   UNIFIED COMPACT HEADER
   ======================================================================== */

.unified-header {
    background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    color: white;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.header-welcome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-welcome h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.header-stat .value {
    font-weight: 600;
}

.header-stat.streak { color: #fbbf24; }
.header-stat.due { color: #fca5a5; }

.header-stat.clickable {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
}

.header-stat.clickable:hover {
    background: rgba(255,255,255,0.15);
}

/* ========================================================================
   SEARCH & FILTERS
   ======================================================================== */

.search-container {
    flex: 1;
    max-width: 320px;
    min-width: 180px;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.5rem;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    font-size: 0.95rem;
}

.search-container input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.search-container .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--jmaths-gray-500);
}

.course-selector {
    background: white;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    color: var(--color-primary-hover);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.course-selector:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.course-selector:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.course-selector option {
    color: var(--color-text);
    background: white;
}

.course-selector-floating {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L2 4h8z'/%3E%3C/svg%3E") no-repeat right 0.6rem center,
        linear-gradient(135deg, var(--color-primary-hover), var(--color-info-hover));
    border: none;
    border-radius: 20px;
    padding: 0.45rem 1.8rem 0.45rem 0.9rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-align-last: center;
    min-width: 70px;
}

.course-selector-floating:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.3);
}

.course-selector-floating:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.3);
}

.course-selector-floating option {
    color: var(--color-text);
    background: white;
    text-align: left;
}

.filter-divider {
    width: 1px;
    height: 20px;
    background: rgba(0,0,0,0.15);
    margin: 0 0.25rem;
}

/* ========================================================================
   SEARCH RESULTS
   ======================================================================== */

.search-results-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--gradient-primary);
    color: white;
}

.search-results-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.search-results-content {
    padding: 0;
}

.search-results-content .search-result-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid var(--jmaths-gray-100);
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.search-results-content .search-result-item:hover {
    background: var(--jmaths-gray-50);
}

.search-results-content .search-result-item:last-child {
    border-bottom: none;
}

.search-results-content .result-main {
    flex: 1;
    min-width: 0;
}

.search-results-content .result-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-results-content .result-id {
    color: var(--jmaths-gray-500);
    font-weight: normal;
    font-size: 0.8rem;
    background: var(--jmaths-gray-100);
    padding: 2px 6px;
    border-radius: 4px;
}

.search-results-content .result-syllabus {
    font-weight: normal;
    font-size: 0.75rem;
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
}

.search-results-content .result-code {
    font-size: 0.8rem;
    color: var(--color-primary);
    margin-top: 4px;
    font-weight: 500;
}

.search-results-content .result-preview {
    font-size: 0.85rem;
    color: var(--jmaths-gray-600);
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-results-content .result-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.search-results-content .result-marks {
    font-size: 0.85rem;
    color: var(--color-success);
    font-weight: 600;
}

.search-results-content .result-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    background: var(--color-primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.search-results-content .result-btn:hover {
    background: var(--color-primary-hover);
}

.search-results-content .no-results,
.search-results-content .searching {
    padding: 2rem;
    text-align: center;
    color: var(--jmaths-gray-500);
}

.search-results-content .results-count {
    padding: 0.75rem 1.25rem;
    background: var(--jmaths-gray-50);
    font-size: 0.85rem;
    color: var(--jmaths-gray-500);
    border-bottom: 1px solid var(--jmaths-gray-100);
}

/* ========================================================================
   ACTION BUTTONS (Header)
   ======================================================================== */

.header-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.action-buttons select {
    padding: 0.4rem 0.5rem;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    cursor: pointer;
    height: 32px;
}

.action-buttons .btn {
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-practice-primary {
    background: white;
    color: var(--color-primary-hover);
    border: none;
    font-weight: 600;
    padding: 0 1.5rem;
    height: 44px;
    font-size: 1rem;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-practice-primary:hover {
    background: #f0fdfa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-practice-primary i {
    font-size: 1.1rem;
}

.btn-pick {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0 1.25rem;
    height: 44px;
    font-size: 0.95rem;
}

.btn-pick:hover {
    background: rgba(255,255,255,0.25);
}

.btn-pick.active {
    background: #fbbf24;
    color: #78350f;
    border-color: #fbbf24;
}

.btn-pick i {
    font-size: 1rem;
}

.btn-more {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1rem;
}

.btn-more:hover {
    background: rgba(255,255,255,0.25);
}

/* ========================================================================
   MORE MENU
   ======================================================================== */

.more-menu-container {
    position: relative;
}

.more-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.more-menu.show {
    display: block;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--jmaths-gray-700);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.more-menu-item:hover {
    background: var(--jmaths-gray-100);
}

.more-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--jmaths-gray-500);
}

.more-menu-item.review-due {
    color: var(--color-danger-hover);
    border-top: 1px solid var(--jmaths-gray-200);
}

.more-menu-item.review-due i {
    color: var(--color-danger-hover);
}

.menu-item-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.menu-item-helper {
    font-size: 0.7rem;
    color: var(--jmaths-gray-400);
    margin-top: 2px;
}

.more-menu-item.review-due .menu-item-helper {
    color: #f87171;
}

/* ========================================================================
   HEATMAP MODAL
   ======================================================================== */

.heatmap-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.heatmap-modal.show {
    display: flex;
}

.heatmap-container {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.heatmap-view-options {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.heatmap-view-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--jmaths-gray-200);
    background: white;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.heatmap-view-btn:hover {
    background: var(--jmaths-gray-100);
}

.heatmap-view-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--jmaths-gray-200);
}

.heatmap-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.heatmap-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--jmaths-gray-500);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.heatmap-close:hover {
    color: var(--jmaths-gray-700);
}

.heatmap-legend {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.heatmap-topic {
    margin-bottom: 0.75rem;
}

.heatmap-topic-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--jmaths-gray-500);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-cells {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.heatmap-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
}

.heatmap-cell:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.heatmap-cell.level-0 { background: var(--color-bg-muted); color: var(--color-text-light); }
.heatmap-cell.level-1 { background: #fecaca; color: #991b1b; }
.heatmap-cell.level-2 { background: #fed7aa; color: #9a3412; }
.heatmap-cell.level-3 { background: #fef08a; color: #854d0e; }
.heatmap-cell.level-4 { background: #bbf7d0; color: #166534; }
.heatmap-cell.level-5 { background: #99f6e4; color: var(--color-primary-hover); }

.heatmap-loading {
    text-align: center;
    padding: 2rem;
    color: var(--jmaths-gray-500);
}

/* ========================================================================
   TOPIC SECTION
   ======================================================================== */

.topic-section {
    margin-bottom: 2rem;
    scroll-margin-top: 140px;
}

.topic-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--jmaths-gray-200);
}

.topic-title {
    flex: 1;
}

.topic-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.topic-title small {
    color: var(--color-text-muted);
}

/* ========================================================================
   QUESTION PREVIEW MODAL
   ======================================================================== */

.question-preview-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* ========================================================================
   IB EXAM PAPER STYLING
   ======================================================================== */

.ib-exam-paper {
    font-family: 'Times New Roman', Georgia, serif;
    font-size: 12pt;
    line-height: 1.6;
    color: #000;
    background: #fff;
    padding: 1.5rem;
}

.ib-exam-paper .question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--jmaths-gray-300);
}

.ib-exam-paper .question-number {
    font-weight: 700;
    font-size: 14pt;
}

.ib-exam-paper .question-marks {
    font-weight: 600;
    color: var(--jmaths-gray-600);
}

.ib-exam-paper .question-context {
    margin-bottom: 1.25rem;
    text-align: justify;
}

.ib-exam-paper .question-stem {
    margin-bottom: 1.5rem;
}

.ib-exam-paper .part-row {
    display: flex;
    margin: 0.75rem 0;
    page-break-inside: avoid;
}

.ib-exam-paper .part-label {
    min-width: 50px;
    font-weight: 600;
    flex-shrink: 0;
}

.ib-exam-paper .part-content {
    flex: 1;
    padding-right: 3rem;
}

.ib-exam-paper .part-marks {
    min-width: 40px;
    text-align: right;
    color: var(--jmaths-gray-600);
    font-weight: 500;
}

.ib-exam-paper .sub-part {
    margin-left: 2rem;
}

.ib-exam-paper .answer-space {
    min-height: 60px;
    border-bottom: 1px dotted #ccc;
    margin: 1rem 0;
}

/* ========================================================================
   PDF EXPORT
   ======================================================================== */

.pdf-export-options {
    background: var(--jmaths-gray-50);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.pdf-export-options label {
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-download-pdf {
    background: var(--color-danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-download-pdf:hover {
    background: var(--color-danger-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-download-pdf:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================================================
   VARIANTS LIST
   ======================================================================== */

.variants-list {
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid #e0e7ff;
}

.variant-item {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.variant-item:hover {
    background: #f0f4ff;
    color: #4338ca;
}

/* ========================================================================
   CONFIDENCE STARS
   ======================================================================== */

.confidence-stars {
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.question-meta .badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.4rem;
}

/* ========================================================================
   WELCOME & BANNERS
   ======================================================================== */

.welcome-placeholder {
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
    border: 2px dashed var(--color-primary);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
}

.welcome-placeholder h4 {
    color: var(--color-primary-hover);
    margin-bottom: 0.5rem;
}

.welcome-placeholder p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.welcome-placeholder .btn {
    background: var(--color-primary);
    color: white;
    border: none;
}

.review-alert {
    background: rgba(254, 243, 199, 0.95);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #92400e;
    font-size: 0.85rem;
}

.review-alert .btn {
    background: var(--color-warning);
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.anon-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
}

.anon-header .header-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.signup-banner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
}

.signup-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.signup-banner-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.signup-banner-icon i {
    font-size: 1.5rem;
    color: white;
}

.signup-banner-text {
    flex: 1;
    color: white;
}

.signup-banner-text h5 {
    font-weight: 600;
    color: white;
}

.signup-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.signup-banner-actions .btn-light {
    background: white;
    color: var(--color-primary);
    font-weight: 600;
    border: none;
}

.signup-banner-actions .btn-light:hover {
    background: #f0f0f0;
}

.signup-banner-actions .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.signup-banner-actions .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* ========================================================================
   MOBILE RESPONSIVE - Topic Accordion & Header
   ======================================================================== */

@media (max-width: 992px) {
    .topic-browser-container .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .subtopic-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .topic-browser-container {
        padding-bottom: 80px;
    }

    .topic-browser-container .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .breadcrumb {
        font-size: 0.85rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    /* Topic accordion - touch friendly */
    .topic-accordion .accordion-item {
        margin-bottom: 0.5rem;
        border-radius: 8px !important;
    }

    .topic-accordion .accordion-button {
        padding: 0.75rem 1rem;
        min-height: 64px;
    }

    .topic-header-content {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .topic-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .topic-number {
        font-size: 0.65rem;
    }

    .topic-name {
        font-size: 0.95rem;
    }

    .topic-count {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }

    /* Subtopic grid - single column on mobile */
    .subtopic-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .subtopic-item {
        padding: 0.875rem 1rem;
        min-height: 48px;
        border-radius: 6px;
    }

    .subtopic-code {
        font-size: 0.9rem;
    }

    .subtopic-count {
        font-size: 0.75rem;
    }

    .subtopic-arrow {
        opacity: 1;
    }

    /* Header responsive */
    .header-top-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-stats {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        max-width: 100%;
    }

    .action-buttons {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-practice-primary {
        height: 40px;
        padding: 0 1rem;
        font-size: 0.9rem;
        min-width: 120px;
    }

    .btn-pick {
        height: 40px;
        padding: 0 1rem;
        font-size: 0.85rem;
    }

    .btn-more {
        width: 40px;
        height: 40px;
    }

    .signup-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .signup-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .signup-banner-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topic-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .topic-name {
        font-size: 0.85rem;
    }

    .btn-practice-primary {
        height: 38px;
        padding: 0 0.75rem;
        min-width: auto;
    }

    .btn-practice-primary .btn-text {
        display: none;
    }

    .btn-pick {
        height: 38px;
        padding: 0 0.75rem;
    }

    .btn-pick .btn-text {
        display: none;
    }

    .btn-more {
        width: 38px;
        height: 38px;
    }
}

/* Landscape mobile - use 2 columns */
@media (max-width: 768px) and (orientation: landscape) {
    .subtopic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .subtopic-item:hover {
        transform: none;
    }

    .subtopic-item:active {
        background: white;
        border-color: var(--topic-color, var(--color-primary));
    }
}

@media print {
    .ib-exam-paper {
        padding: 0;
        font-size: 11pt;
    }
    .no-print {
        display: none !important;
    }
}
