/* Dissertation Verifier — premium glassmorphism design system (Phase 3) */

:root {
  --bg: #070b16;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.12);
  --accent-a: #8b5cf6;
  --accent-b: #06b6d4;
  --accent-c: #ec4899;
  --radius: 20px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(139, 92, 246, 0.28), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(6, 182, 212, 0.20), transparent 60%),
    radial-gradient(700px 600px at 50% 110%, rgba(236, 72, 153, 0.14), transparent 60%),
    var(--bg);
}
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: drift 18s ease-in-out infinite alternate; }
.orb-1 { width: 420px; height: 420px; left: -120px; top: -80px; background: #7c3aed; }
.orb-2 { width: 360px; height: 360px; right: -100px; top: 12%; background: #0891b2; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; left: 38%; bottom: -120px; background: #be185d; animation-delay: -12s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.12); }
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px 80px; }

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav {
  position: sticky; top: 16px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; margin: 16px auto 0; max-width: 880px;
  border-radius: 16px;
  animation: slideDown 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.5);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 8px;
  border: 2.5px solid rgba(255, 255, 255, 0.9); border-top-color: transparent;
  border-radius: 50%; transform: rotate(45deg);
}
.auth-inline { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.auth-inline .who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  color: #fff; border: none; cursor: pointer;
  padding: 11px 22px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 12px 32px rgba(139, 92, 246, 0.45); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: var(--glass-strong); border: 1px solid var(--stroke);
  box-shadow: none; color: var(--ink);
}
.btn-ghost:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.3); }

.field label { display: block; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.input, textarea.input {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 13px 15px; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder { color: #64748b; }
.input:focus { border-color: var(--accent-a); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25); background: rgba(0,0,0,0.4); }
textarea.input { resize: vertical; min-height: 110px; }

.hero { text-align: center; padding: 64px 0 30px; animation: rise 0.7s cubic-bezier(0.22,1,0.36,1) 0.08s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.hero h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 5.4vw, 3.2rem);
  margin: 0 0 14px; line-height: 1.12; letter-spacing: -0.5px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, #c4b5fd, var(--accent-b), #f9a8d4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 600px; margin: 0 auto; line-height: 1.6; }

.search-card { padding: 28px; margin-top: 8px; animation: rise 0.7s cubic-bezier(0.22,1,0.36,1) 0.16s both; }
.search-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.search-card .full { grid-column: 1 / -1; }
.search-card .actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.search-card .hint { font-size: 0.85rem; color: var(--muted); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 15, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(400px, calc(100vw - 40px)); padding: 30px; animation: pop 0.32s cubic-bezier(0.22,1,0.36,1); }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal h2 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.35rem; }
.modal .sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 18px; }
.modal .field { margin-bottom: 14px; }
.modal .status { min-height: 1.4em; font-size: 0.88rem; margin: 12px 0 0; }
.modal .status.err { color: #fda4af; }
.modal .status.ok { color: #6ee7b7; }
.modal .switch { margin-top: 16px; font-size: 0.88rem; color: var(--muted); text-align: center; }
.modal .switch button { background: none; border: none; color: #c4b5fd; font-weight: 600; cursor: pointer; font-size: 0.88rem; padding: 0; }

.results-head { margin: 34px 0 18px; animation: rise 0.5s ease both; }
.results-head h2 { font-family: var(--font-display); margin: 0 0 8px; font-size: 1.5rem; }
.results-head .meta { color: var(--muted); font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.src-pill {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--stroke);
}
.src-openalex { background: rgba(139, 92, 246, 0.18); color: #d8b4fe; }
.src-crossref { background: rgba(59, 130, 246, 0.16); color: #bfdbfe; }
.src-semanticscholar { background: rgba(6, 182, 212, 0.14); color: #a5f3fc; }

.card-result { padding: 22px; margin-bottom: 16px; transition: transform 0.2s ease, border-color 0.2s ease; animation: cardIn 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.card-result:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, 0.4); }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.card-result .top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.card-result h3 { margin: 0 0 8px; font-size: 1.08rem; line-height: 1.45; font-weight: 650; }
.card-result h3 a { color: var(--ink); text-decoration: none; }
.card-result h3 a:hover { color: #c4b5fd; text-decoration: underline; }
.card-result .byline { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.card-result .abs { color: #cbd5e1; font-size: 0.93rem; line-height: 1.65; margin: 0 0 14px; }
.match-line { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
.match-line b { color: #c4b5fd; font-weight: 600; }
.score-row { display: flex; align-items: center; gap: 10px; }
.score-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.score-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); transition: width 0.8s cubic-bezier(0.22,1,0.36,1); }
.score-num { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.verdict { display: inline-block; margin-top: 14px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.4px; padding: 6px 14px; border-radius: 999px; }
.verdict-high { background: rgba(236, 72, 153, 0.16); color: #f9a8d4; border: 1px solid rgba(236,72,153,0.35); }
.verdict-med { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border: 1px solid rgba(251,191,36,0.3); }
.verdict-low { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.3); }

.skel { padding: 22px; margin-bottom: 16px; overflow: hidden; position: relative; }
.skel .line { height: 14px; border-radius: 7px; background: rgba(255,255,255,0.09); margin-bottom: 12px; }
.skel .line::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.09) 50%, transparent 80%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.notice {
  padding: 18px 22px; margin: 26px 0; font-size: 0.95rem; line-height: 1.6;
  border-left: 3px solid var(--accent-a);
}
.notice.err { border-left-color: #f43f5e; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }

footer { text-align: center; color: #475569; font-size: 0.82rem; margin-top: 60px; }

@media (max-width: 640px) {
  .search-card .grid { grid-template-columns: 1fr; }
  .nav { top: 10px; margin: 10px 12px 0; }
  .wrap { padding: 0 14px 60px; }
  .hero { padding: 44px 0 22px; }
  .auth-inline .who { display: none; }
}
