/* style.css — OA Nemo. Vanilla CSS, chủ đề "under the sea". */

:root {
  --deep: #041e3a;
  --deep-2: #0a3358;
  --sea: #0e7c9b;
  --sea-light: #29b6c9;
  --foam: #e8f6f9;
  --sand: #f6f2e7;
  --ink: #0b2540;
  --muted: #5a7184;
  --ok: #12805c;
  --warn: #b45309;
  --warn-bg: #fff4e5;
  --err: #b02a2a;
  --card: #ffffff;
  --shadow: 0 10px 40px rgba(4, 30, 58, 0.18);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, #12507e 0%, transparent 60%),
    linear-gradient(180deg, var(--deep) 0%, var(--deep-2) 45%, #0d456e 100%);
  min-height: 100vh;
  line-height: 1.55;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 18px 60px;
}

/* Top bar (help + language) */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  position: relative;
  z-index: 110; /* trên cả guide overlay (100) để đổi ngôn ngữ/mở lại khi guide đang mở */
}
.topbar-left { display: flex; gap: 8px; }

.help-btn {
  display: inline-block;
  text-decoration: none;
  padding: 6px 14px;
  border: 1.5px solid rgba(232, 246, 249, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: var(--foam);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.help-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: var(--sea-light); }

/* Language toggle */
.lang-toggle {
  display: flex;
  gap: 4px;
}
.lang-btn {
  padding: 5px 12px;
  border: 1.5px solid rgba(232, 246, 249, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: var(--foam);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lang-btn:hover { background: rgba(255, 255, 255, 0.14); }
.lang-btn.active {
  background: var(--sea-light);
  border-color: var(--sea-light);
  color: var(--deep);
}

/* Header */
.header { text-align: center; color: var(--foam); margin-bottom: 26px; }
.logo {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 0 0 6px;
  letter-spacing: 0.5px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
.wave { display: inline-block; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.tagline {
  font-style: italic;
  color: var(--sea-light);
  margin: 0;
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
}

/* Card / form */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.92rem; color: var(--ink); }

input[type="text"], input[type="email"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cfdce6;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fbfdff;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
input[type="text"]:focus, input[type="email"]:focus, textarea:focus {
  outline: none;
  border-color: var(--sea-light);
  box-shadow: 0 0 0 3px rgba(41, 182, 201, 0.18);
}

.hint { color: var(--muted); font-size: 0.8rem; }
.hint a { color: var(--sea); }

/* Inline tip under search box */
.tip-inline {
  background: #eef8fb;
  border: 1px solid #cdeaf1;
  border-radius: 8px;
  padding: 8px 12px;
  color: #0b5c72;
  font-size: 0.85rem;
}
.tip-inline strong { color: var(--sea); }

/* Advanced */
.advanced { border-top: 1px dashed #d7e2ea; padding-top: 12px; }
.advanced summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--sea);
  user-select: none;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.checkbox.small { font-size: 0.82rem; color: var(--muted); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--sea); }
.link-btn {
  background: none; border: none; color: var(--err);
  cursor: pointer; font-size: 0.8rem; text-decoration: underline; padding: 0;
}
.hidden { display: none !important; }

/* Button */
.btn-primary {
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sea) 0%, var(--sea-light) 100%);
  color: white;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(14, 124, 155, 0.4);
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(14, 124, 155, 0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Result area */
.result { margin-top: 22px; }
.result:empty { margin-top: 0; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Multi-result: summary bar + cards */
.results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.summary-text { font-weight: 700; color: var(--ink); }
.btn-download-all {
  padding: 9px 18px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ok) 0%, #1aa877 100%);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(18, 128, 92, 0.35);
  transition: transform 0.1s;
}
.btn-download-all:hover { transform: translateY(-1px); }
.max-note {
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  margin: 0 0 14px;
}

.result-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 12px;
}
.result-card:last-child { margin-bottom: 0; }
.card-query {
  font-size: 0.82rem;
  color: var(--muted);
  background: #f4f8fa;
  border-radius: 7px;
  padding: 7px 11px;
  margin-bottom: 12px;
  word-break: break-word;
}
.result-card .meta-title { font-size: 1.1rem; }
.result-card .btn-download { font-size: 1rem; padding: 11px 22px; margin: 12px 0 4px; }

.row-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.mini-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(14, 124, 155, 0.2);
  border-top-color: var(--sea);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Loading */
.loading { text-align: center; color: var(--foam); padding: 20px; }
.spinner {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border: 4px solid rgba(232, 246, 249, 0.25);
  border-top-color: var(--sea-light);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Meta */
.meta-title { font-size: 1.25rem; margin: 0 0 6px; color: var(--ink); }
.meta-line { color: var(--muted); font-size: 0.9rem; margin: 2px 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-left: 8px;
  vertical-align: middle;
}
.badge.article { background: #e3f0ff; color: #1e5fa8; }
.badge.preprint { background: #fff0d9; color: #a35b00; }
.badge.thesis { background: #ece4ff; color: #5b3ea8; }
.badge.unknown { background: #eceff1; color: #607d8b; }

/* Download button */
.btn-download {
  display: inline-block;
  margin: 18px 0 4px;
  padding: 14px 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ok) 0%, #1aa877 100%);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(18, 128, 92, 0.4);
  transition: transform 0.1s;
}
.btn-download:hover { transform: translateY(-1px); }

.download-info { font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; }

/* no_file reason */
.reason {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  padding: 14px 16px;
  color: #7a4a12;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.reason strong { display: block; margin-bottom: 4px; color: var(--warn); }

/* Direct links */
.direct-links { margin-top: 18px; }
.direct-links h4 { font-size: 0.9rem; margin: 0 0 10px; color: var(--ink); font-weight: 700; }
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid #dbe6ee;
  border-radius: 9px;
  text-decoration: none;
  color: var(--sea);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.12s, border-color 0.12s;
  word-break: break-word;
}
.link-item:hover { background: var(--foam); border-color: var(--sea-light); }
.link-item .arrow { margin-left: auto; color: var(--muted); }

/* Error */
.error-msg {
  background: #fdeaea;
  border-left: 4px solid var(--err);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--err);
}

/* Guide modal */
body.no-scroll { overflow: hidden; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 18, 34, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  animation: rise 0.22s ease;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: #eef2f5; color: var(--ink); }

.modal-title {
  margin: 0 0 16px;
  font-size: 1.4rem;
  color: var(--ink);
}

.tip-box {
  background: #fff7e6;
  border: 1.5px solid #ffd98a;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #6b4b12;
  margin-bottom: 18px;
}
.tip-box strong { color: #a35b00; }

.guide-steps {
  margin: 0 0 18px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guide-steps li { font-size: 0.95rem; line-height: 1.55; color: var(--ink); padding-left: 4px; }
.guide-steps li::marker { color: var(--sea); font-weight: 800; }

.guide-note {
  font-size: 0.85rem;
  color: var(--muted);
  background: #f4f8fa;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 20px;
  line-height: 1.55;
}
.guide-note strong { color: var(--ink); }

.modal .btn-primary { width: 100%; }

/* Footer */
.footer { margin-top: 34px; text-align: center; }
.footer p { color: rgba(232, 246, 249, 0.7); font-size: 0.8rem; line-height: 1.6; }
.footer strong { color: var(--foam); }

.credit {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px solid rgba(232, 246, 249, 0.14);
  color: rgba(232, 246, 249, 0.6) !important;
}
.credit a {
  color: var(--sea-light);
  text-decoration: none;
  font-weight: 600;
}
.credit a:hover { text-decoration: underline; }
