/* ============================================================
   AnonFiles.uk — Global Stylesheet
   Dark-first design, CSS custom properties, mobile-first
   ============================================================ */

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-input: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #2ea043;
  --accent-hover: #3fb950;
  --accent-blue: #1f6feb;
  --accent-blue-hover: #388bfd;
  --danger: #f85149;
  --warning: #d29922;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #57606a;
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand:hover { text-decoration: none; opacity: 0.85; }
.brand-icon { font-size: 1.3rem; }

.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; transition: color var(--transition); }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem 0.5rem;
  color: var(--text-muted);
  transition: border-color var(--transition);
}
.theme-toggle:hover { border-color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-download { background: var(--accent-blue); color: #fff; font-size: 1.1rem; padding: 1rem 2rem; width: 100%; }
.btn-download:hover { background: var(--accent-blue-hover); text-decoration: none; color: #fff; }
.btn-copy { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); flex: 1; }
.btn-copy:hover { border-color: var(--text-muted); }
.btn-extend { background: transparent; color: var(--warning); border: 1px solid var(--warning); width: 100%; }
.btn-extend:hover { background: rgba(210,153,34,0.1); text-decoration: none; }
.btn-copy-small {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.btn-copy-small:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Hero / Homepage ── */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem 2rem;
  text-align: center;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 480px;
}

.badges {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Upload zone ── */
.upload-zone {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(31,111,235,0.05);
}

.upload-zone.drag-over { transform: scale(1.01); }

.upload-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.upload-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.4rem; }
.upload-hint { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.upload-input { display: none; }

.upload-or { color: var(--text-muted); font-size: 0.85rem; margin: 1rem 0; }

/* ── Progress ── */
.progress-wrap {
  display: none;
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.progress-filename {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stage steps indicator */
.upload-stage {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  animation: stagePulse 1.8s ease-in-out infinite;
}
.upload-stage.visible { display: flex; }
@keyframes stagePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.progress-bar-track {
  background: var(--bg-input);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Result card ── */
.result-card {
  display: none;
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.result-success { border-color: var(--accent); }

.result-title { font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }

.result-url-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
}

.result-url {
  flex: 1;
  font-size: 0.88rem;
  color: var(--accent-blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── File page ── */
.file-main, .pay-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem;
}

.file-card, .pay-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.file-card.expired { border-color: var(--danger); opacity: 0.85; }

.file-icon-wrap { text-align: center; margin-bottom: 1rem; }
.file-icon { font-size: 3.5rem; }

.file-name {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  word-break: break-all;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.file-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.meta-item { display: flex; flex-direction: column; gap: 0.2rem; }
.meta-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-value { font-size: 0.9rem; font-weight: 500; word-break: break-all; }
.text-danger { color: var(--danger); }

.download-section { display: flex; flex-direction: column; gap: 0.75rem; }
.share-row { display: flex; gap: 0.75rem; align-items: center; }
.qr-wrap { flex-shrink: 0; }
.qr-wrap canvas { border-radius: 4px; }

.extend-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.extend-text { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.expiry-note { font-size: 0.82rem; color: var(--text-muted); text-align: center; margin: 0.5rem 0 1rem; opacity: 0.8; }

.expired-msg { text-align: center; }
.expired-msg p { color: var(--text-muted); margin-bottom: 1rem; }

.back-link { margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }

/* ── Payment page ── */
.pay-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.pay-file-name { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.25rem; word-break: break-all; }
.pay-current-expiry { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.pay-description { margin-bottom: 1.5rem; line-height: 1.6; }

.coin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.coin-tab {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}
.coin-tab.active { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(31,111,235,0.1); }

.coin-panel { display: none; }
.coin-panel.active { display: block; }

.coin-amount { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--warning); }

.qr-address-wrap { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.qr-address-wrap canvas { border-radius: 4px; flex-shrink: 0; }

.address-box {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.address-box code {
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.pay-note { font-size: 0.82rem; color: var(--text-muted); background: var(--bg-input); padding: 0.75rem; border-radius: var(--radius-sm); line-height: 1.5; }

.pay-status { margin-top: 1.5rem; text-align: center; padding: 1rem; border-radius: var(--radius-sm); background: var(--bg-input); }
.pay-status p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.pay-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Donate / About pages ── */
.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem;
}

.page-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
}

.page-card h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.page-card h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; color: var(--text-muted); }
.page-card p { line-height: 1.7; color: var(--text-muted); margin-bottom: 0.75rem; }
.page-card ul { color: var(--text-muted); line-height: 1.8; padding-left: 1.25rem; }

.donate-coins { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 480px) { .donate-coins { grid-template-columns: 1fr; } }

.donate-coin-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.donate-coin-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.donate-coin-card canvas { border-radius: 4px; margin-bottom: 0.75rem; }
.donate-addr { font-size: 0.7rem; word-break: break-all; color: var(--text-muted); font-family: monospace; margin-bottom: 0.5rem; }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* ── 404/410 ── */
.error-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.error-code { font-size: 6rem; font-weight: 800; color: var(--border); line-height: 1; }
.error-msg { font-size: 1.2rem; color: var(--text-muted); margin: 0.5rem 0 1.5rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .navbar { padding: 0.75rem 1rem; }
  .hero { padding: 2rem 1rem 1.5rem; }
  .upload-zone { padding: 2rem 1.25rem; }
  .file-meta { grid-template-columns: 1fr; }
  .share-row { flex-direction: column; }
  .qr-address-wrap { flex-direction: column; }
  .page-card { padding: 1.5rem; }
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }

.upload-success-animation {
  animation: successPulse 0.5s ease;
}
@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
