/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #f0f7ff;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #c62828 0%, #a52020 100%);
    border-radius: 10px;
    border: 2px solid #f0f7ff;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #e74c3c 0%, #c62828 100%);
    border: 2px solid #e8f0ff;
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #a52020 0%, #8b1a1a 100%);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #c62828 #f0f7ff;
}

:root {
    --bg: #f6f5ef;
    --surface: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --navy: #0d1b3e;
    --navy-2: #162f63;
    --navy-soft: #e6edf9;
    --accent: #c51f14;
    --accent-2: #a91710;
    --brand: #0f766e;
    --brand-2: #115e59;
    --danger: #dc2626;
    --ok: #166534;
    --border: #d1d5db;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow-x: hidden;
    font-family: "Poppins", "Segoe UI", sans-serif;
    color: var(--ink);
    background: #ffffff;
}

body.public-page {
    background: #ffffff;
}

body.home-page {
    background: #ffffff;
}

body.public-page a:not(.btn) {
    color: #1d4d92;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    padding: 20px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.title {
    margin: 0;
    font-size: 1.45rem;
}

.muted {
    color: var(--muted);
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-2);
}

.btn-dashboard {
    background: var(--navy);
    color: #fff;
}

.btn-dashboard:hover {
    background: var(--navy-2);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-2);
}

.btn-outline {
    border: 1px solid var(--border);
    color: var(--ink);
    background: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

input,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--brand);
}

body.public-page input:focus,
body.public-page select:focus {
    border-color: #1d4d92;
    box-shadow: 0 0 0 3px rgba(29, 77, 146, 0.15);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 11px;
    border-bottom: 1px solid #edf0f3;
    vertical-align: top;
}

th {
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.alert {
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.alert-success {
    background: #dcfce7;
    color: var(--ok);
}

.alert-error {
    background: #fee2e2;
    color: var(--danger);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-shell {
    display: grid;
    gap: 16px;
}

.public-hero {
    background: linear-gradient(135deg, var(--navy) 0, #1f4a8f 100%);
    color: #fff;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 40px rgba(15, 34, 76, 0.22);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.public-hero-copy {
    max-width: 700px;
}

.public-kicker {
    margin: 0;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    color: #000;
}

.public-title {
    margin: 6px 0;
    font-size: clamp(1.3rem, 2vw, 1.9rem);
    font-weight: 700;
    color: #fff;
}

.public-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.86);
}

.public-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-card {
    padding: 16px 18px;
}

.search-form {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
}

.search-form .btn {
    min-width: 106px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 36px 22px;
}

.empty-state h2 {
    margin: 0 0 6px;
    font-size: 1.2rem;
    color: var(--navy);
}

.viewer-head-card {
    padding: 22px;
}

.viewer-head-grid {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.viewer-main {
    min-width: 0;
    flex: 1;
}

.viewer-title {
    color: var(--navy);
    margin-top: 6px;
}

.viewer-sub {
    margin: 0 0 8px;
    font-size: 0.88rem;
}

.viewer-actions {
    justify-content: flex-end;
}

.viewer-card {
    padding: 14px;
    overflow: hidden;
}

.viewer-tall {
    width: 100%;
    max-width: 100%;
    height: 76vh;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    display: block;
}

.poster-top-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.poster-top-title {
    margin-top: 6px;
    color: var(--navy);
}

.poster-top-sub {
    margin: 0;
    font-size: 0.9rem;
}

.poster-top-actions {
    justify-content: flex-end;
}

/* ===== Modals ===== */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    animation: modal-in 0.2s ease;
}

.modal-sm {
    max-width: 380px;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--ink);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.form-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 500;
}

.form-label input {
    margin: 0;
}

/* ===== Permanent link bar ===== */
.plink-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7f9fe;
    border: 1px solid #d7dfef;
    border-radius: 10px;
    min-width: 0;
    margin-top: 6px;
    max-width: 100%;
    overflow: hidden;
    padding: 8px 12px;
}

.plink-bar-sm {
    padding: 5px 8px;
    margin-top: 2px;
    background: #f3f6fd;
    border-color: #d7dfef;
}

.plink-icon {
    flex-shrink: 0;
    color: #1d4d92;
    display: flex;
    align-items: center;
}

.plink-icon svg {
    width: 15px;
    height: 15px;
}

.plink-url {
    flex: 1;
    font-size: 0.78rem;
    color: #1d4d92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    text-decoration: none;
}

.plink-url:hover {
    text-decoration: underline;
}

.plink-copy {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.plink-copy svg {
    width: 13px;
    height: 13px;
}

.plink-copy:hover {
    background: var(--navy-2);
    transform: translateY(-1px);
}

.plink-copy.copied {
    background: #16a34a;
}

/* Poster thumbnail in cards */
.poster-thumb-link {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #e5e7eb;
}

.poster-thumb-wrap {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.poster-thumb-frame {
    width: 1100px;
    height: 700px;
    border: none;
    pointer-events: none;
    transform-origin: top left;
    display: block;
}

.poster-thumb-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    /* skeleton placeholder until loaded */
    aspect-ratio: 2382 / 2970;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: img-shimmer 1.4s infinite;
}
.poster-thumb-img.loaded {
    background: none;
    animation: none;
    aspect-ratio: auto;
}
@keyframes img-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* PDF card grid */
.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.pdf-card {
    background: var(--surface);
    border: 1px solid #d8dfeb;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 42, 86, 0.08);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pdf-card:hover {
    box-shadow: 0 18px 40px rgba(15, 42, 86, 0.16);
    transform: translateY(-2px);
}

.pdf-card-icon {
    width: 48px;
    height: 48px;
    background: #f0fdf4;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--brand);
    flex-shrink: 0;
}

.pdf-card-icon svg {
    width: 26px;
    height: 26px;
}

.pdf-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-card-title {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--navy);
}

.pdf-card-link {
    font-size: 0.78rem;
    word-break: break-all;
    color: var(--brand);
}

.pdf-card-date {
    margin: 4px 0 0;
    font-size: 0.78rem;
}

.pdf-card-actions {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: auto;
}

.viewer {
    width: 100%;
    height: 70vh;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.poster-wrap {
    display: grid;
    gap: 20px;
}

.exam-poster {
    width: 794px;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #08214a;
    position: relative;
    padding: 26px 34px 28px;
    color: #f8fafc;
    font-family: "Montserrat", "Poppins", sans-serif;
    background: url('../images/bg.jpeg') center / cover no-repeat;
}

/* Top row: cities left, media-logo right */
.poster-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.poster-cities {
    font-family: "Montserrat", sans-serif;
    font-size: clamp(11px, 1.6vw, 20px);
    font-weight: 600;
    color: #ffd429;
    letter-spacing: 0.04em;
}

.poster-cities span {
    color: #e63946;
    margin: 0 4px;
}

.poster-media-logo {
    height: clamp(50px, 8vw, 100px);
    width: auto;
    object-fit: contain;
}

.poster-cef-logo {
    height: clamp(32px, 5vw, 60px);
    width: auto;
    object-fit: contain;
}

/* Footer logos */
.poster-footer-logo {
    height: clamp(76px, 5vw, 65px);
    width: auto;
    object-fit: contain;
}

.poster-footer-site {
    height: clamp(66px, 5vw, 65px);
    width: auto;
    object-fit: contain;
}

.exam-title {
    margin: 48px 0 20px;
    font-size: clamp(50px, 3.8vw, 46px);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: .02em;
    width: 92%;
    max-width: 92%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.4);
    -webkit-text-stroke: 0.5px rgba(255,255,255,0.15);
}

.exam-subject-box {
    background: #ffcf00;
    color: #0f172a;
    border-radius: 14px;
    min-height: 80px;
    border: none;
    outline: 2px dashed #000000;
    outline-offset: -5px;
    font-weight: 700;
    text-align: center;
    display: grid;
    place-items: center;
    font-size: clamp(21px, 3vw, 34px);
    padding: 10px 16px;
    width: fit-content;
    min-width: 60%;
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
    word-break: break-word;
}

.exam-subtitle {
    margin: 30px 0 22px;
    text-align: center;
    color: #39f5ff;
    font-size: clamp(28px, 3.8vw, 50px);
    letter-spacing: .03em;
}

.exam-scan-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-bottom: 0;
}

.scan-text {
    display: grid;
    color: #ffffff;
    line-height: .9;
}

.scan-text span {
    font-family: "Great Vibes", cursive;
    color: #ffd429;
    font-size: clamp(46px, 6.2vw, 84px);
}

.scan-text small {
    font-style: normal;
    font-size: clamp(24px, 3.2vw, 44px);
    font-weight: 500;
    margin-left: 12px;
}

.qr-shell {
    border: 2px dashed rgba(255, 255, 255, .78);
    border-radius: 20px;
    padding: 12px;
}

.qr-core {
    width: clamp(180px, 25vw, 280px);
    height: clamp(180px, 25vw, 280px);
    background: #e5e7eb;
    border-radius: 20px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

#qrcode img, #qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.exam-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-top: 60px;
}

.exam-brand {
    font-size: clamp(24px, 3.8vw, 52px);
    font-weight: 800;
    line-height: 1;
}

.exam-brand small {
    display: block;
    font-size: clamp(8px, 1.4vw, 17px);
    font-weight: 600;
    margin-top: 8px;
    opacity: .96;
}

.exam-visit {
    text-align: right;
}

.exam-visit strong {
    display: block;
    font-size: clamp(28px, 3.8vw, 48px);
    margin-bottom: 4px;
}

.exam-visit span {
    font-size: clamp(11px, 1.7vw, 22px);
    opacity: .95;
}

.exam-link {
    position: absolute;
    left: 40px;
    bottom: 18px;
    right: 40px;
    font-size: clamp(11px, 1.45vw, 18px);
    opacity: .78;
    text-align: center;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .public-hero,
    .viewer-head-grid,
    .poster-top-card {
        flex-direction: column;
        align-items: stretch;
    }

    .public-hero-actions,
    .viewer-actions,
    .poster-top-actions {
        justify-content: flex-start;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-form .btn {
        width: 100%;
    }
}

/* ===== Category + Year Navigation (Home page) ===== */
.home-cat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.home-cat-block {
    background: var(--surface);
    border: 1px solid #d8dfeb;
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(13,27,62,.06);
}

.home-cat-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--navy);
    text-decoration: none;
    letter-spacing: .01em;
}

.home-cat-name:hover {
    color: var(--accent);
    text-decoration: none;
}

.home-cat-years {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-cat-year {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--ink);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, color .2s, border-color .2s;
    white-space: nowrap;
    display: inline-block;
}

.home-cat-year:hover,
body .home-cat-year:hover {
    background: #cf2e2e;
    border-color: #cf2e2e;
    color: #fff !important;
    text-decoration: none;
}

/* ===== Category / Year tags on cards ===== */
.pdf-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 2px;
}

.cat-tag {
    display: inline-block;
    background: var(--navy-soft);
    color: var(--navy) !important;
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .18s, color .18s;
    white-space: nowrap;
}

.cat-tag:hover {
    background: var(--navy);
    color: #fff !important;
    text-decoration: none;
}

.cat-tag-year {
    background: #fef9c3;
    color: #854d0e !important;
}

.cat-tag-year:hover {
    background: #ca8a04;
    color: #fff !important;
}

/* ===== Category page styles ===== */
.cat-breadcrumb {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cat-breadcrumb a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
}

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

.cat-bc-sep {
    color: #cbd5e1;
}

.cat-bc-cur {
    color: var(--ink);
    font-weight: 600;
}

.cat-page-head {
    margin-bottom: 20px;
}

.cat-page-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cat-year-badge {
    display: inline-block;
    background: var(--navy);
    color: #fff;
    border-radius: 8px;
    padding: 3px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.cat-page-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.cat-year-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.cat-year-tab {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--ink);
    border-radius: 24px;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}

.cat-year-tab:hover {
    background: #fdecea;
    border-color: #cf2e2e;
    color: #cf2e2e;
    text-decoration: none;
}

.cat-year-tab.active {
    background: #cf2e2e;
    border-color: #cf2e2e;
    color: #fff !important;
}

/* Year group sections */
.cat-year-group {
    margin-bottom: 36px;
}

.cat-year-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    border-bottom: 2px solid #e8edf5;
    padding-bottom: 8px;
    gap: 12px;
}

.cat-year-group-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
}

.cat-year-group-link {
    font-size: 0.82rem;
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.cat-year-group-link:hover {
    text-decoration: underline;
}

/* Subject page — clickable title on card */
.pdf-card-title-link {
    text-decoration: none;
    color: inherit;
}

.pdf-card-title-link:hover .pdf-card-title {
    color: var(--accent);
    text-decoration: none;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    body {
        background: #fff;
    }
    .container {
        width: 210mm;
        margin: 0;
    }
    .card.poster-wrap {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
    .poster-wrap .actions {
        display: none;
    }
    .exam-poster {
        width: 210mm !important;
        height: 245mm !important;
        transform: none !important;
        border-radius: 0;
        border: 0;
    }
}

@media (max-width: 700px) {
    .exam-poster {
        padding: 18px 14px 36px;
    }
    .exam-title {
        margin-top: 18px;
    }
    .exam-scan-area {
        gap: 10px;
    }
    .scan-text small {
        margin-left: 0;
    }
    .exam-link {
        left: 12px;
        right: 12px;
    }
}

/* ══════════════════════════════════════════════════════
   Hub page (/question-papers)
   ══════════════════════════════════════════════════════ */

/* Search bar */
.hub-search-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.hub-search {
    position: relative;
    width: 100%;
    max-width: 520px;
}

.hub-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

.hub-search-input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.hub-search-input:focus {
    border-color: var(--navy-2);
    box-shadow: 0 0 0 3px rgba(22, 47, 99, .1);
}

.hub-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, color .15s;
}

.hub-search-clear:hover {
    background: #f1f5f9;
    color: var(--ink);
}

.hub-search-clear svg {
    width: 16px;
    height: 16px;
}

/* Category tabs */
.hub-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.hub-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px 11px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: color .2s, border-color .2s, background .2s;
    white-space: nowrap;
}

.hub-tab:hover {
    color: var(--navy);
    background: var(--navy-soft);
}

.hub-tab.active {
    color: var(--navy-2);
    border-bottom-color: var(--navy-2);
    font-weight: 600;
}

.hub-tab-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    transition: background .2s, color .2s;
}

.hub-tab.active .hub-tab-count {
    background: var(--navy-soft);
    color: var(--navy-2);
}

/* Section labels (category headings in "All" tab) */
.hub-section-label {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 32px 0 10px;
    padding-left: 4px;
    border-left: 3px solid var(--navy-2);
    padding-left: 10px;
}

/* Year accordions */
.hub-accordion {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow .2s;
}

.hub-accordion:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

.hub-acc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: background .15s;
}

.hub-acc-head:hover {
    background: #f8fafc;
}

.hub-acc-year {
    font-size: .95rem;
    font-weight: 600;
    color: var(--navy);
    flex: 1;
}

.hub-count {
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 9px;
    border-radius: 20px;
}

.hub-acc-catlink {
    font-size: .78rem;
    color: var(--navy-2);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--navy-soft);
    transition: background .15s;
    white-space: nowrap;
}

.hub-acc-catlink:hover {
    background: #c8d8f5;
}

.hub-acc-chevron {
    width: 18px;
    height: 18px;
    color: var(--muted);
    flex-shrink: 0;
    transition: transform .25s ease;
}

.hub-acc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

/* Subject table */
.hub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.hub-table thead th {
    padding: 8px 16px;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.hub-table tbody tr + tr {
    border-top: 1px solid #f1f5f9;
}

.hub-row {
    transition: background .15s;
}

.hub-row:hover {
    background: #f8fafc;
}

.hub-td-subject {
    padding: 12px 16px;
    font-weight: 500;
    color: var(--ink);
    vertical-align: middle;
}

.hub-subject-link {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
    transition: color .15s, border-color .15s;
}

.hub-subject-link:hover {
    color: var(--navy-2);
    border-bottom-color: var(--navy-2);
}

.hub-td-btns {
    padding: 10px 16px;
    vertical-align: middle;
    white-space: nowrap;
}

/* Doc type buttons */
.hub-doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 5px;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    vertical-align: middle;
    margin: 2px 2px;
    line-height: 1.4;
}

.hub-doc-btn:hover {
    opacity: .88;
    transform: translateY(-1px);
}

.hub-doc-paper {
    background: #dbeafe;
    color: #1e40af;
}

.hub-doc-key {
    background: #dcfce7;
    color: #166534;
}

.hub-doc-sol {
    background: #ffedd5;
    color: #9a3412;
}

.hub-doc-view {
    background: #f1f5f9;
    color: #475569;
}

.hub-doc-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 5px;
    background: #f1f5f9;
    color: #475569;
    margin: 2px 2px;
    text-decoration: none;
    transition: background .15s, color .15s, transform .1s;
}

.hub-doc-dl:hover {
    background: var(--navy-soft);
    color: var(--navy-2);
    transform: translateY(-1px);
}

.hub-doc-dl svg {
    width: 14px;
    height: 14px;
}

/* Category footer link */
.hub-cat-link-row {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 24px;
}

.hub-cat-link {
    font-size: .85rem;
    font-weight: 500;
    color: var(--navy-2);
    text-decoration: none;
    padding: 6px 14px;
    border: 1.5px solid var(--navy-soft);
    border-radius: 7px;
    background: var(--navy-soft);
    transition: background .15s, border-color .15s;
}

.hub-cat-link:hover {
    background: #c8d8f5;
    border-color: #a5bede;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .hub-tabs {
        gap: 4px;
    }

    .hub-tab {
        padding: 8px 12px 10px;
        font-size: .82rem;
    }

    .hub-acc-head {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .hub-acc-year {
        flex: 1 1 100%;
    }

    .hub-table {
        font-size: .82rem;
    }

    .hub-td-subject,
    .hub-td-btns {
        padding: 10px 12px;
    }

    .hub-table thead th {
        padding: 7px 12px;
    }

    .hub-doc-btn {
        font-size: .74rem;
        padding: 3px 8px;
    }
}

/* ── Public pagination ──────────────────────────────────────────────────────── */
.pub-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 32px 0 8px;
}
.pub-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    color: #374151;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: background .15s, border-color .15s, color .15s;
    cursor: pointer;
    line-height: 1;
}
.pub-pag-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.pub-pag-active {
    background: #cf2e2e !important;
    color: #fff !important;
    border-color: #cf2e2e !important;
    cursor: default;
}
.pub-pag-disabled {
    opacity: .38;
    cursor: default;
    pointer-events: none;
}
.pub-pag-ellipsis {
    font-size: 14px;
    color: #94a3b8;
    padding: 0 2px;
    line-height: 38px;
}
@media (max-width: 480px) {
    .pub-pag-btn { min-width: 34px; height: 34px; font-size: 13px; }
}
