/* ── importaCVN — shared styles ── */

:root {
  --bg: #faf8f6;
  --surface: #ffffff;
  --surface-dim: #f3f0ec;
  --border: #ece7e1;
  --border-focus: #f45d22;
  --text: #2d2a26;
  --text-secondary: #6e6a64;
  --text-muted: #a09a92;
  --accent: #f45d22;
  --accent-light: #fff0eb;
  --accent-hover: #e04d18;
  --danger: #c53030;
  --danger-light: #fed7d7;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --ok-bg: #f0faf4;
  --ok-text: #1a7a42;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(45,42,38,0.04);
  --shadow: 0 2px 8px rgba(45,42,38,0.06), 0 0 0 1px rgba(45,42,38,0.03);
  --shadow-lg: 0 4px 16px rgba(45,42,38,0.08);
  --font-body: 'Quicksand', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --transition: 180ms ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

/* ── Header ── */
.header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); padding: 0 24px; }
.header-inner { max-width: 780px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { display: flex; align-items: baseline; gap: 10px; }
.logo h1 { font-family: var(--font-body); font-size: 20px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.logo h1 span { color: var(--accent); }
.logo small { font-size: 11.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.2px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ── */
.btn { font-family: var(--font-body); font-size: 13px; font-weight: 700; padding: 8px 18px; border-radius: 99px; cursor: pointer; transition: all var(--transition); border: 1.5px solid transparent; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 2px 8px rgba(244,93,34,0.25); }
.btn-primary:disabled { background: #ccc; border-color: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-dim); border-color: #ddd6ce; }
.btn-ghost { background: none; color: var(--text-secondary); border: none; padding: 7px 10px; border-radius: var(--radius-sm); }
.btn-ghost:hover { color: var(--text); background: var(--surface-dim); }
.btn-danger-ghost { background: none; border: 1.5px solid var(--danger-light); color: var(--danger); padding: 4px 10px; font-size: 11px; border-radius: 99px; }
.btn-danger-ghost:hover { background: var(--danger-light); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface-dim); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding: 4px; }
.tab { flex: 1; padding: 10px 16px; font-family: var(--font-body); font-size: 13.5px; font-weight: 700; text-align: center; cursor: pointer; border: none; background: transparent; color: var(--text-muted); transition: all var(--transition); position: relative; border-radius: var(--radius-sm); }
.tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.6); }
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.tab.active::after { display: none; }
.tab-icon { margin-right: 6px; font-size: 11px; font-weight: 700; opacity: 0.6; }

/* ── Layout ── */
.main { max-width: 780px; margin: 0 auto; padding: 24px 24px 80px; overflow: hidden; }

/* ── Input panel ── */
.input-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; box-shadow: var(--shadow); }
.input-panel label { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.input-row { display: flex; gap: 10px; align-items: flex-end; min-width: 0; }
.input-row textarea { flex: 1; min-width: 0; padding: 10px 14px; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; border: 1.5px solid var(--border); border-radius: var(--radius-sm); resize: vertical; outline: none; color: var(--text); background: var(--surface); transition: border-color var(--transition), box-shadow var(--transition); }
.input-row textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(244,93,34,0.1); }
.input-row textarea::placeholder { color: var(--text-muted); font-family: var(--font-body); font-size: 13px; }
.input-hint { margin-top: 10px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.input-hint code, .step-text code { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-dim); padding: 1px 5px; border-radius: 3px; }

/* ── Steps ── */
.steps { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding: 12px 14px; background: var(--surface-dim); border-radius: var(--radius-sm); flex-wrap: wrap; justify-content: center; }
.step { display: flex; align-items: center; gap: 7px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.step-text { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.step-arrow { color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* ── Feedback ── */
.input-feedback { margin-top: 10px; font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.input-feedback.error { color: var(--danger); }
.input-feedback.loading { color: var(--accent); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--accent-light); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.35; }
.empty p:first-of-type { font-weight: 500; font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.empty p:last-of-type { font-size: 12.5px; }

/* ── Entries header ── */
.entries-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.entries-count { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }

/* ── DOI cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); animation: fadeIn 0.25s ease; }
.card:hover { box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface-dim); border-bottom: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
.card-head-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.card-type { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; border: 1.5px solid var(--accent-light); background: var(--accent-light); color: var(--accent); cursor: pointer; flex-shrink: 0; }
.card-title { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ── Pills ── */
.pill { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 99px; letter-spacing: 0.2px; }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-loading { background: var(--warning-bg); color: var(--warning-text); }
.pill-error { background: var(--danger-light); color: var(--danger); }

/* ── Card details ── */
.card-summary { padding: 9px 14px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.card-summary strong { color: var(--text); font-weight: 600; }
.card-summary em { font-style: italic; }
.card-edit { padding: 16px; display: none; }
.card-edit.open { display: block; }

/* ── Fields ── */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 3px; }
.field input, .field textarea, .field select { width: 100%; padding: 8px 12px; font-size: 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); outline: none; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); font-family: var(--font-body); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--border-focus); background: var(--surface); box-shadow: 0 0 0 3px rgba(244,93,34,0.1); }
.field .mono { font-family: var(--font-mono); font-size: 12.5px; }
.field textarea { resize: vertical; }

.extra-toggle { font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; margin-top: 4px; margin-bottom: 10px; display: inline-block; }
.extra-toggle:hover { color: var(--accent-hover); }
.extra-fields { display: none; }
.extra-fields.open { display: block; }

/* ── BibTeX view ── */
.bibtex-view { display: none; }
.bibtex-view.active { display: block; }
.bibtex-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bibtex-pre, .cicyt-pre { background: #2d2a26; color: #e8e0d8; border-radius: var(--radius); padding: 18px 22px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.8; overflow: auto; max-height: 500px; white-space: pre-wrap; word-break: break-word; tab-size: 2; }

/* ── Congress results ── */
.congress-result { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px; overflow: hidden; animation: fadeIn 0.25s ease; }
.congress-result:hover { box-shadow: var(--shadow); }
.congress-result-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface-dim); border-bottom: 1px solid var(--border); gap: 8px; }
.congress-result-header h3 { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.congress-fields { padding: 16px; }
.congress-field { margin-bottom: 10px; }
.congress-field label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 3px; }
.congress-field input, .congress-field select { width: 100%; padding: 8px 12px; font-size: 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); outline: none; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); font-family: var(--font-body); }
.congress-field input:focus, .congress-field select:focus { border-color: var(--border-focus); background: var(--surface); box-shadow: 0 0 0 3px rgba(244,93,34,0.1); }

.cicyt-output { padding: 16px; border-top: 1px solid var(--border); }
.cicyt-output-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cicyt-output-header h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

/* ── Misc ── */
.section-hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #2d2a26; color: #f3f0ec; padding: 10px 22px; border-radius: 99px; font-size: 13px; font-weight: 600; z-index: 200; opacity: 0; transition: all 0.3s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── FAQ ── */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.faq-item summary { padding: 12px 16px; font-family: var(--font-body); font-size: 13.5px; font-weight: 700; color: var(--text); cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 18px; font-weight: 600; color: var(--text-muted); }
.faq-item[open] summary::after { content: '−'; }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-item p { padding: 12px 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin: 0; }

/* ── Footer ── */
.site-footer { margin-top: 60px; padding: 28px 0; border-top: 1px solid var(--border); }
.footer-inner { max-width: 720px; margin: 0 auto; padding: 0 20px; font-size: 12.5px; color: var(--text-muted); line-height: 1.7; font-weight: 500; }
.footer-inner a { color: var(--text-secondary); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.footer-inner a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.footer-divider { margin: 10px 0; border: none; border-top: 1px solid var(--border); }

/* ── Mobile ── */
@media (max-width: 600px) {
  .header { padding: 0 14px; }
  .header-inner { height: 50px; }
  .logo small { display: none; }
  .main { padding: 16px 12px 60px; }
  .input-panel { padding: 14px; }
  .input-row { flex-direction: column; }
  .input-row textarea { min-width: 0; width: 100%; }
  .input-row .btn { width: 100%; justify-content: center; }
  .field-grid { grid-template-columns: 1fr; }
  .header-actions { gap: 4px; }
  .btn { padding: 7px 12px; font-size: 12px; }
  .tabs { gap: 2px; padding: 3px; }
  .tab { font-size: 12px; padding: 9px 8px; }
  .tab-icon { display: none; }
  .steps { flex-direction: column; gap: 8px; align-items: flex-start; }
  .step-arrow { display: none; }
  .card-head { padding: 10px 12px; }
  .card-head-left { flex-wrap: wrap; }
  .card-title { white-space: normal; font-size: 13px; }
  .card-edit { padding: 12px; }
  .congress-result-header { padding: 10px 12px; }
  .congress-result-header h3 { white-space: normal; font-size: 13px; }
  .congress-fields { padding: 12px; }
  .cicyt-output { padding: 12px; }
  .bibtex-pre, .cicyt-pre { padding: 14px; font-size: 11.5px; }
  .footer-inner { font-size: 12px; }
}

@media (max-width: 380px) {
  .logo h1 { font-size: 17px; }
  .main { padding: 12px 10px 50px; }
  .input-panel { padding: 12px; }
  .tab { font-size: 11.5px; padding: 8px 6px; }
}

/* ── Desktop: better readability ── */
@media (min-width: 900px) {
  .header-inner { max-width: 960px; }
  .main { max-width: 960px; }
  .footer-inner { max-width: 900px; }
  .input-panel label { font-size: 15px; }
  .input-row textarea { font-size: 15px; }
  .input-hint { font-size: 13px; }
  .tab { font-size: 14.5px; }
  .step-text { font-size: 13.5px; }
  .card-title { font-size: 15px; }
  .card-summary { font-size: 14px; }
  .empty p:first-of-type { font-size: 15px; }
  .empty p:last-of-type { font-size: 13.5px; }
  .entries-count { font-size: 13.5px; }
  .field label { font-size: 11.5px; }
  .field input, .field textarea, .field select { font-size: 14px; }
  .congress-field label { font-size: 11.5px; }
  .congress-field input, .congress-field select { font-size: 14px; }
  .bibtex-pre, .cicyt-pre { font-size: 13.5px; }
  .footer-inner { font-size: 13.5px; }
}
