@import url('theme.css');

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--bg-body);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

[data-theme="dark"] body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* ── Site nav ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
}

.nav-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}

.nav-brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: var(--accent-muted);
  color: var(--ink);
}

.nav-links a.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav-email {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 6px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-theme-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}

.nav-theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-signout {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-signout:hover { color: var(--danger); }

/* ── Page shell ───────────────────────────────────────────────────────── */
.page-shell        { max-width: 960px; margin: 40px auto; padding: 0 24px 80px; }
.page-shell-narrow { max-width: 640px; margin: 40px auto; padding: 0 24px 80px; }

/* ── Typography ───────────────────────────────────────────────────────── */
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem;  font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled             { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost     { background: none; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled)     { color: var(--ink); }
.btn-outline-accent { background: none; border-color: var(--accent); color: var(--accent); }
.btn-outline-accent:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-danger    { background: none; border-color: transparent; color: var(--muted); }
.btn-danger:hover:not(:disabled)    { border-color: var(--danger); color: var(--danger); }

.btn-lg { padding: 12px 26px; font-size: 1rem; }
.btn-sm { padding: 5px 14px;  font-size: 0.8rem; border-radius: 8px; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-pending    { background: var(--surface-solid); color: var(--muted);   border: 1px solid var(--line); }
.badge-processing { background: var(--warning-bg);    color: var(--warning); }
.badge-complete   { background: var(--success-bg);    color: var(--success); }
.badge-error      { background: var(--danger-bg);     color: var(--danger);  }

/* ── Card / Panel ─────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Form elements ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.97rem;
  padding: 10px 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

textarea { resize: vertical; min-height: 100px; }

.hint   { font-size: 0.77rem; color: var(--muted); margin-top: 5px; }
.error  { color: var(--danger); font-size: 0.83rem; margin-top: 10px; display: none; }
.field-error { border-color: var(--danger) !important; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}

.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.modal-desc  { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }

/* ── Spinner ──────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress bar ─────────────────────────────────────────────────────── */
.progress-bar-bg {
  background: var(--line);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.2s;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-email   { display: none; }
  .page-shell,
  .page-shell-narrow { padding: 0 16px 60px; margin-top: 24px; }
  h1 { font-size: 1.4rem; }
}
