/* ============================================================
   Scopus Search — Deep Violet theme (prefix sc-)
   All colors use q4family CSS variables
   ============================================================ */

/* ── Hero ─────────────────────────────────────────────────── */
.sc-hero {
    padding: 40px 0 24px;
}
.sc-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}
.sc-hero h1 span {
    color: var(--primary);
}
.sc-hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* ── Card ─────────────────────────────────────────────────── */
.sc-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
}

/* ── Search form ──────────────────────────────────────────── */
.sc-form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.sc-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.sc-form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.sc-form-group input[type="text"],
.sc-form-group input[type="number"] {
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}
.sc-form-group input:focus {
    border-color: var(--primary);
}
.sc-fg-searchby { min-width: 140px; }
.sc-fg-query    { flex: 1; min-width: 200px; }
.sc-fg-year     { width: 90px; }

/* ── Buttons ──────────────────────────────────────────────── */
.sc-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.sc-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
}
.sc-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.sc-btn-primary {
    background: var(--primary);
    color: #fff;
}
.sc-btn-primary:hover:not(:disabled) {
    background: var(--primary-strong);
}
.sc-btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--card-border);
}
.sc-btn-outline:hover:not(:disabled) {
    background: var(--card-strong);
}

/* ── Alert ────────────────────────────────────────────────── */
.sc-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.sc-alert i { color: #ef4444; }

/* ── Loading spinner ──────────────────────────────────────── */
.sc-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.sc-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--card-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sc-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ── Nav bar (single row: filter | pagination | count+size) ── */
.sc-nav-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 0 4px 12px;
    min-height: 42px;
}
.sc-nav-left {
    display: flex;
    align-items: center;
}
.sc-nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.sc-nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
    min-width: 0;
}
.sc-results-count {
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sc-results-count strong { color: var(--text); }
.sc-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.sc-filter-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}
.sc-filter-input {
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 7px 30px 7px 28px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
    width: 230px;
}
.sc-filter-input:focus { border-color: var(--primary); }
.sc-filter-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.sc-filter-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
}
.sc-filter-clear:hover { color: var(--text); }
.sc-page-size-select {
    -webkit-appearance: none;
    appearance: none;
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 7px 28px 7px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a78bfa'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.sc-page-size-select:focus { border-color: var(--primary); }
.sc-page-size-select option {
    background-color: #1a1330;
    color: #f5f3ff;
}
body.light-mode .sc-page-size-select option {
    background-color: #faf8ff;
    color: #1e1b4b;
}

/* ── Table ────────────────────────────────────────────────── */
.sc-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}
.sc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.sc-table thead th {
    background: var(--card-strong);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 10px 12px;
    white-space: nowrap;
    border-bottom: 1px solid var(--card-border);
}
.sc-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}
.sc-table thead th.sortable:hover {
    color: var(--text);
    background: var(--card);
}
.sc-table tbody tr {
    border-bottom: 1px solid var(--card-border);
    transition: background 0.1s;
}
.sc-table tbody tr:last-child { border-bottom: none; }
.sc-table tbody tr:hover { background: var(--card-strong); }
.sc-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    color: var(--text);
}
.sc-table .col-num {
    color: var(--text-muted);
    text-align: center;
    width: 36px;
}
.sc-paper-title {
    font-weight: 500;
    line-height: 1.45;
    color: var(--text);
}
.sc-due-authors {
    color: #10b981;
    font-weight: 500;
}
.sc-doi-link {
    color: var(--text-muted);
    text-decoration: none;
    word-break: break-all;
}
.sc-doi-link:hover {
    color: var(--primary);
    text-decoration: underline;
}
.sc-muted { color: var(--text-muted); }
.sc-nowrap { white-space: nowrap; }

/* SDG badges */
.sc-sdg-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--card-border);
}
.sc-sdg-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
    cursor: default;
    white-space: nowrap;
}
body.light-mode .sc-sdg-badge {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
}
.sc-sdg-source {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.7;
    font-style: italic;
}

/* Raw JSON buttons */
.sc-raw-btns {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--card-border);
}
.sc-raw-btn {
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.70rem;
    font-weight: 500;
    font-family: inherit;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sc-raw-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

/* Raw JSON modal */
.sc-raw-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 20px;
    overflow-y: auto;
}
.sc-raw-modal.sc-hidden { display: none; }
.sc-raw-modal-box {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}
.sc-raw-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 0.92rem;
    flex-shrink: 0;
}
.sc-raw-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.sc-raw-modal-close:hover { color: var(--text); }
.sc-raw-modal-pre {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    font-size: 0.76rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre;
    font-family: "Consolas", "Fira Code", "Courier New", monospace;
    margin: 0;
}

/* ── Sort icons (Font Awesome) ────────────────────────────── */
.sort-icon {
    font-size: 0.68rem;
    margin-left: 3px;
    opacity: 0.5;
}
.sort-icon.active-sort {
    opacity: 1;
    color: var(--primary);
}

/* ── Quartile badges ──────────────────────────────────────── */
.sc-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.sc-q1 { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.sc-q2 { background: rgba(167, 139, 250, 0.18); color: var(--primary); }
.sc-q3 { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.sc-q4 { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.sc-qna { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* ── Compact pagination ───────────────────────────────────── */
.sc-pg-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 0;
    transition: color 0.15s;
    flex-shrink: 0;
}
.sc-pg-btn:hover:not(:disabled) { color: var(--primary); }
.sc-pg-btn:disabled { opacity: 0.25; cursor: default; }
.sc-pg-input {
    width: 44px;
    height: 30px;
    text-align: center;
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}
.sc-pg-input::-webkit-inner-spin-button,
.sc-pg-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sc-pg-input:focus { border-color: var(--primary); }
.sc-pg-total {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ── API key warning ──────────────────────────────────────── */
.sc-warning-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.sc-warning-banner i { color: #f59e0b; }

/* ── Year input — hide number spinner arrows ──────────────── */
.sc-fg-year input[type="number"]::-webkit-inner-spin-button,
.sc-fg-year input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.sc-fg-year input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ── Utility ──────────────────────────────────────────────── */
.sc-hidden { display: none !important; }

/* ── Export overlay (injected via JS) ────────────────────── */
.sc-export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sc-export-overlay-box {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    text-align: center;
    min-width: 280px;
    box-shadow: var(--shadow);
}
.sc-export-overlay-box p {
    margin: 14px 0 4px;
    font-weight: 600;
    color: var(--text);
}
.sc-export-overlay-box small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sc-hero { padding: 24px 0 16px; }
    .sc-hero h1 { font-size: 1.4rem; }
    .sc-form-row { flex-direction: column; }
    .sc-fg-searchby,
    .sc-fg-query,
    .sc-fg-year { width: 100%; min-width: unset; }
    .sc-btn-row { flex-direction: column; }
    .sc-btn { justify-content: center; }
    .sc-nav-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .sc-nav-left { width: 100%; }
    .sc-filter-input { width: 100%; }
    .sc-nav-center { justify-content: center; }
    .sc-nav-right { justify-content: space-between; }
}


/* CrossRef unverified badge */
.sc-source-crossref {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72em;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 99px;
    background: rgba(234,179,8,.15);
    color: #ca8a04;
    border: 1px solid rgba(234,179,8,.35);
    vertical-align: middle;
    margin-left: 6px;
}
body.light-mode .sc-source-crossref {
    color: #92400e;
    background: rgba(234,179,8,.2);
}

/* CrossRef phase-2 inline loading bar */
.sc-crossref-loading-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    font-size: .88rem;
    color: var(--text-muted);
}
.sc-spinner-sm {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(167,139,250,.3);
    border-top-color: var(--primary);
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
