/* faculty_profile.css - public faculty profile page (standalone) */
/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0; padding: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    background: #f1f4f8;
    color: #1e293b;
    line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout wrapper ───────────────────────────────────────────── */
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px 48px; }

/* ── Profile header ───────────────────────────────────────────── */
.profile-header {
    background: linear-gradient(135deg, #1a2d4a 0%, #243b61 100%);
    color: #fff;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.profile-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 36px 24px 32px;
    display: flex;
    align-items: flex-start;
    gap: 28px;
}
.avatar {
    flex-shrink: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 3px solid rgba(255,255,255,.30);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
}
.header-info { flex: 1; min-width: 0; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.profile-link-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 700; color: #fff !important;
    text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform .12s, box-shadow .12s;
}
.profile-link-pill:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.faculty-name {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.title-line {
    font-size: .95rem;
    color: rgba(255,255,255,.80);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.title-chip {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: .82rem;
    white-space: nowrap;
}
.contact-line {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: .85rem;
    color: rgba(255,255,255,.70);
    margin-top: 8px;
}
.contact-item { display: flex; align-items: center; gap: 5px; }
.contact-item svg { opacity: .75; flex-shrink: 0; }

/* ── Header action buttons ────────────────────────────────────── */
.header-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background .18s, box-shadow .18s;
}
.btn-bib {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.25);
}
.btn-bib:hover  { background: rgba(255,255,255,.22); color: #fff; text-decoration: none; }
.btn-ris  {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.88);
    border-color: rgba(255,255,255,.18);
}
.btn-ris:hover  { background: rgba(255,255,255,.18); color: #fff; text-decoration: none; }
.btn-print {
    background: transparent;
    color: rgba(255,255,255,.65);
    border-color: rgba(255,255,255,.15);
}
.btn-print:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }
.btn-pdf {
    background: rgba(220,38,38,.75);
    color: #fff;
    border-color: rgba(220,38,38,.5);
}
.btn-pdf:hover  { background: rgba(220,38,38,.95); color: #fff; text-decoration: none; }
.btn-xlsx {
    background: rgba(21,128,61,.7);
    color: #fff;
    border-color: rgba(21,128,61,.5);
}
.btn-xlsx:hover { background: rgba(21,128,61,.9); color: #fff; text-decoration: none; }

/* ── Stats row ────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin: 24px 0 0;
}
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: #1a2d4a;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #64748b;
}

/* ── Section cards ────────────────────────────────────────────── */
.section-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.section-head {
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title {
    font-size: .95rem;
    font-weight: 700;
    color: #1a2d4a;
    margin: 0;
}
.section-count {
    margin-left: auto;
    background: #1a2d4a;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}
.section-body { padding: 6px 20px 18px; }

/* ── Year summary ─────────────────────────────────────────────── */
.year-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px 10px;
    padding: 14px 20px 18px;
}
.year-label {
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    text-align: right;
}
.year-bar-wrap { height: 18px; background: #f1f4f8; border-radius: 4px; overflow: hidden; }
.year-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 4px;
    min-width: 4px;
    transition: width .3s ease;
}
.year-count {
    font-size: .82rem;
    font-weight: 700;
    color: #1a2d4a;
    min-width: 24px;
    text-align: left;
}

/* ── Research summary (charts + pivot) ────────────────────────── */
.rs-charts {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 18px;
    padding: 16px 20px 10px;
    align-items: center;
}
.rs-charts.rs-2 { grid-template-columns: 1.6fr 1fr; }
.rs-chart { position: relative; height: 210px; }
.rs-table-wrap { overflow-x: auto; padding: 6px 20px 18px; }
.rs-table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.rs-table th, .rs-table td {
    border: 1px solid #e8edf3;
    padding: 5px 9px;
    text-align: center;
    white-space: nowrap;
}
.rs-table thead th { background: #1a2d4a; color: #fff; font-weight: 600; }
.rs-table .rs-year { font-weight: 700; color: #1a2d4a; }
.rs-table .rs-total { font-weight: 700; background: #f8fafc; }
.rs-table tfoot td { background: #eef2f7; font-weight: 700; color: #1a2d4a; }
.rs-zero { color: #cbd5e1; }
@media (max-width: 700px) {
    .rs-charts, .rs-charts.rs-2 { grid-template-columns: 1fr; }
}

/* ── Sticky toolbar ───────────────────────────────────────────── */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    margin: 20px -20px 0;
    padding: 10px 20px 0;
    background: #f1f4f8;
}
.toolbar.stuck { box-shadow: 0 6px 14px rgba(0,0,0,.08); }

/* Section navigation chips */
.sec-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}
.sec-chip {
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}
.sec-chip:hover { background: #eef2f7; }
.sec-chip.active { background: #1a2d4a; color: #fff; border-color: #1a2d4a; }
.sec-chip .chip-n {
    font-size: .7rem;
    opacity: .7;
    margin-left: 4px;
}

/* ── Home-university (ADU) toggle ─────────────────────────────── */
.adu-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin-bottom: 8px;
    background: #eef2fb;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
}
.adu-ico { color: #1a2d4a; display: flex; }
.adu-text { font-size: .85rem; font-weight: 700; color: #1a2d4a; }
.adu-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.adu-switch input { opacity: 0; width: 0; height: 0; }
.adu-track { position: absolute; inset: 0; background: #cbd5e1; border-radius: 24px; transition: .2s; }
.adu-track::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.adu-switch input:checked + .adu-track { background: #1a2d4a; }
.adu-switch input:checked + .adu-track::before { transform: translateX(20px); }
.adu-tip { color: #64748b; cursor: help; font-size: 1rem; line-height: 1; }
.adu-tip:focus-visible { outline: 2px solid #93c5fd; border-radius: 50%; }
@media (max-width: 700px) { .adu-text { font-size: .8rem; } }

/* ── Filter bar ───────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.filter-title { font-size: .82rem; font-weight: 700; color: #1a2d4a; }
.filter-search {
    flex: 1 1 200px;
    min-width: 160px;
    font-size: .82rem;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #1e293b;
}
.filter-search:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.filter-sel {
    font-size: .82rem;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #1e293b;
    cursor: pointer;
}
.filter-sel:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.filter-chk { font-size: .82rem; color: #475569; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.filter-reset {
    font-size: .8rem;
    padding: 6px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}
.filter-reset:hover { background: #e2e8f0; }
.filter-result { font-size: .8rem; color: #64748b; margin-left: auto; font-weight: 600; }
.pub-empty {
    text-align: center;
    color: #64748b;
    padding: 30px;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
}

/* ── Collapsible sections ─────────────────────────────────────── */
.sec-toggle { cursor: pointer; user-select: none; }
.sec-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: -2px; }
.sec-caret { font-size: .8rem; color: #64748b; transition: transform .18s; margin-right: 2px; }
.section-card.collapsed .sec-caret { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }

/* ── Back to top ──────────────────────────────────────────────── */
.back-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #1a2d4a;
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
    z-index: 60;
}
.back-top.show { opacity: 1; visibility: visible; }
.back-top:hover { background: #243b61; }

/* ── Export & Tools dropdown (all sizes) ──────────────────────── */
.export-menu { position: relative; }
.export-summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 6px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.28);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}
.export-summary::-webkit-details-marker { display: none; }
.export-summary::marker { content: ""; }
.export-summary:hover { background: rgba(255,255,255,.24); }
.export-caret { font-size: .7rem; transition: transform .15s; margin-left: 2px; }
.export-menu[open] .export-caret { transform: rotate(180deg); }
.export-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 70;
}
.export-menu-list a {
    padding: 9px 12px;
    border-radius: 6px;
    color: #1e293b;
    font-size: .85rem;
    white-space: nowrap;
}
.export-menu-list a:hover { background: #f1f5f9; text-decoration: none; }
.export-sep { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    color: #94a3b8; padding: 8px 12px 4px; border-top: 1px solid #e2e8f0; margin-top: 4px; }

/* ── Publication list ─────────────────────────────────────────── */
.pub-list {
    list-style: none;
    margin: 0; padding: 0;
    counter-reset: pub-counter;
}
.pub-item {
    counter-increment: pub-counter;
    padding: 14px 0;
    border-bottom: 1px solid #f1f4f8;
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0 12px;
    align-items: start;
}
.pub-item:last-child { border-bottom: none; }
.pub-num {
    font-size: .78rem;
    font-weight: 700;
    color: #94a3b8;
    padding-top: 2px;
    text-align: right;
}
.pub-num::before { content: counter(pub-counter) "."; }
.pub-body {}
.pub-citation {
    font-size: .88rem;
    color: #1e293b;
    line-height: 1.55;
    margin-bottom: 6px;
}
.pub-citation em { font-style: italic; }
.pub-citation .pub-title { font-weight: 600; color: #1a2d4a; }
.pub-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.badge-q1  { background: #dcfce7; color: #166534; }
.badge-q2  { background: #d1fae5; color: #065f46; }
.badge-q3  { background: #fef9c3; color: #854d0e; }
.badge-q4  { background: #f3f4f6; color: #374151; }
.badge-oa  { background: #fef3c7; color: #92400e; }
.badge-cited { background: #e0e7ff; color: #3730a3; }
.badge-doi {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    text-decoration: none;
    font-size: .68rem;
}
.badge-doi:hover { background: #dbeafe; }

/* In-text DOI (APA) */
.pub-doi-link { color: #1d4ed8; word-break: break-all; }

/* Per-paper Cite button */
.cite-btn {
    font-size: .68rem; font-weight: 700; padding: 2px 9px;
    border-radius: 12px; border: 1px solid #cbd5e1;
    background: #f8fafc; color: #475569; cursor: pointer;
    text-transform: uppercase; letter-spacing: .3px;
}
.cite-btn:hover { background: #eef2f7; border-color: #93c5fd; color: #1a2d4a; }

/* Header Share button */
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 6px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
    color: #fff; font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.share-btn:hover { background: rgba(255,255,255,.24); }
.share-btn.copied { background: #16a34a; border-color: #16a34a; }

/* Cite modal */
.cite-modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.cite-modal-overlay.open { display: flex; }
.cite-modal-box {
    background: #fff; border-radius: 12px; width: 100%; max-width: 640px;
    max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.cite-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; background: #fff;
}
.cite-modal-head h3 { margin: 0; font-size: 1.05rem; color: #1a2d4a; }
.cite-modal-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #64748b; }
.cite-modal-body { padding: 16px 20px 20px; }
.cite-fmt { margin-bottom: 16px; }
.cite-fmt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.cite-fmt-head span { font-size: .78rem; font-weight: 700; color: #1a2d4a; text-transform: uppercase; letter-spacing: .4px; }
.cite-text {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 10px 12px; font-size: .85rem; color: #1e293b; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.cite-text.mono { font-family: ui-monospace, "Courier New", monospace; font-size: .78rem; max-height: 200px; overflow: auto; }
.cite-copybtn {
    font-size: .72rem; font-weight: 700; padding: 4px 12px; border-radius: 6px;
    border: 1px solid #cbd5e1; background: #f1f5f9; color: #475569; cursor: pointer;
}
.cite-copybtn:hover { background: #e2e8f0; }
.cite-copybtn.copied { background: #dcfce7; color: #166534; border-color: #86efac; }
.cite-share-row { border-top: 1px solid #e2e8f0; padding-top: 14px; }

/* ── Footer ───────────────────────────────────────────────────── */
.pub-footer {
    margin-top: 40px;
    text-align: center;
    font-size: .78rem;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
    .profile-header-inner { flex-direction: column; gap: 20px; }
    .export-menu-list { left: 0; right: auto; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .avatar { width: 60px; height: 60px; font-size: 1.4rem; }
    .faculty-name { font-size: 1.35rem; }
    .filter-result { margin-left: 0; }
}
@media (max-width: 420px) {
    .stats-row { grid-template-columns: 1fr; }
}

/* ── Print ────────────────────────────────────────────────────── */
@media print {
    body { background: #fff; }
    .profile-header { background: #1a2d4a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .header-actions { display: none; }
    .section-card { box-shadow: none; border: 1px solid #ccc; }
    .badge { border: 1px solid #999; }
    .pub-footer { display: none; }
}

/* Visible short public link in the profile header */
.profile-shortlink { font-size: .82rem; margin: 2px 0 6px; opacity: .9; }
.profile-shortlink-url { font-family: ui-monospace, monospace; letter-spacing: .2px; user-select: all; }

/* Back-to-directory bar on public profile */
.profile-topbar { background: #14223b; padding: 8px 18px; }
.profile-back { color: #cbd5e1; text-decoration: none; font-size: .85rem; font-weight: 600; }
.profile-back:hover { color: #fff; }
