/* ============================================================
   WanderShare – Premium Dark UI
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────── */
:root {
  --bg:           #080810;
  --surface:      #0e0e1a;
  --surface-2:    #141425;
  --border:       #1c1c35;
  --border-hover: #2a2a50;
  --accent:       #6366f1;
  --accent-dark:  #4f52d0;
  --accent-light: rgba(99, 102, 241, 0.15);
  --accent-glow:  rgba(99, 102, 241, 0.25);
  --text:         #e2e2f0;
  --text-muted:   #7070a0;
  --text-subtle:  #3a3a60;
  --success:      #10b981;
  --error:        #ef4444;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --transition:   0.18s ease;
}

/* ── Reset / base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; padding-top: 80px; }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

input, textarea { font-family: inherit; }

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes progressShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes successPop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(8, 8, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  transition: color var(--transition);
}
.nav-logo:hover { color: var(--accent); }
.nav-logo svg { flex-shrink: 0; }

.nav-links { display: flex; gap: 8px; }

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 24px 40px;
  max-width: 640px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 52px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Upload section ───────────────────────────────────────── */
.upload-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.4);
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* ── Tab panels ───────────────────────────────────────────── */
.tab-panel {
  animation: fadeIn 0.2s ease;
}

/* ── Drop zone ────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  text-align: center;
  margin-bottom: 0;
}
.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.01);
}

.drop-zone-icon { color: var(--text-muted); }
.drop-zone-text { display: flex; flex-direction: column; gap: 4px; }
.drop-primary { font-weight: 500; font-size: 15px; }
.drop-secondary { font-size: 13px; color: var(--text-muted); }
.drop-zone-hint { font-size: 12px; color: var(--text-subtle); margin-top: 4px; }

.file-label {
  color: var(--accent);
  cursor: pointer;
  transition: text-decoration var(--transition);
}
.file-label:hover { text-decoration: underline; }

.file-input { display: none; }

/* ── Selected file ────────────────────────────────────────── */
.selected-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 0;
}
.selected-file-icon { color: var(--accent); flex-shrink: 0; }
.selected-file-info { flex: 1; min-width: 0; }
.selected-file-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-file-size { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.selected-file-remove {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.selected-file-remove:hover { color: var(--error); background: rgba(239,68,68,0.1); }

/* ── Text area ────────────────────────────────────────────── */
.text-area {
  width: 100%;
  min-height: 160px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition);
  outline: none;
}
.text-area::placeholder { color: var(--text-subtle); }
.text-area:focus { border-color: var(--accent); }

/* ── TTL row ──────────────────────────────────────────────── */
.ttl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.ttl-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.ttl-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.ttl-pill {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.ttl-pill:hover { border-color: var(--border-hover); color: var(--text); }
.ttl-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Progress ─────────────────────────────────────────────── */
.progress-container { padding-top: 20px; }

.progress-bar-track {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  width: 0%;
  transition: width 0.2s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Upload button ────────────────────────────────────────── */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-top: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}
.upload-btn:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.upload-btn:active { transform: scale(0.99); }
.upload-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Success state ────────────────────────────────────────── */
.success-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
  animation: fadeIn 0.3s ease;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  animation: successPop 0.4s ease forwards;
}

.success-title { font-size: 22px; font-weight: 700; }
.success-sub { font-size: 14px; color: var(--text-muted); }

/* ── Link row ─────────────────────────────────────────────── */
.link-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.link-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  cursor: text;
  outline: none;
  min-width: 0;
}
.link-input:focus { border-color: var(--border-hover); }

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.copy-btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.copy-icon, .check-icon { display: block; }

/* ── Success actions ──────────────────────────────────────── */
.success-actions { display: flex; gap: 10px; justify-content: center; }

.qr-toggle-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.qr-toggle-btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-2); }

.new-upload-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.new-upload-btn:hover { background: var(--accent); color: #fff; }

/* ── QR container ─────────────────────────────────────────── */
.qr-container {
  display: flex;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.qr-image {
  max-width: 200px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px;
}

/* ── Recent section ───────────────────────────────────────── */
.recent-section {
  max-width: 560px;
  margin: 0 auto 48px;
  padding: 0 16px;
}

.recent-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.recent-list { display: flex; flex-direction: column; gap: 6px; }

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  transition: border-color var(--transition);
  gap: 12px;
}
.recent-item:hover { border-color: var(--border-hover); }

.recent-item-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.recent-item-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.recent-item-link {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
  transition: opacity var(--transition);
}
.recent-item-link:hover { opacity: 0.7; }

.recent-item-delete {
  color: var(--text-subtle);
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--transition);
  flex-shrink: 0;
}
.recent-item-delete:hover { color: var(--error); }

/* ── Features ─────────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 840px;
  margin: 0 auto 80px;
  padding: 0 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color var(--transition), transform var(--transition);
}
.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.feature-icon { font-size: 32px; margin-bottom: 14px; display: block; }

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* ── Share page ───────────────────────────────────────────── */
.share-page {
  display: flex;
  justify-content: center;
  padding: 40px 16px 80px;
}

.share-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  padding: 40px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.share-type-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.file-icon { color: var(--accent); }
.text-icon { color: #a78bfa; }

.share-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

.share-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}
.share-meta-dot { color: var(--text-subtle); }

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition), box-shadow var(--transition);
}
.download-btn:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Text content box ─────────────────────────────────────── */
.text-content-box {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}
.text-content-box::-webkit-scrollbar { width: 6px; }
.text-content-box::-webkit-scrollbar-track { background: transparent; }
.text-content-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.text-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}

/* ── Text actions ─────────────────────────────────────────── */
.text-actions { display: flex; gap: 10px; }

.copy-text-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.copy-text-btn:hover { background: var(--accent); color: #fff; }

.raw-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.raw-btn:hover { color: var(--text); border-color: var(--border-hover); }

/* ── Share link section ───────────────────────────────────── */
.share-link-section {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-new-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
  transition: background var(--transition), color var(--transition);
}
.share-new-btn:hover { background: var(--accent); color: #fff; }

/* ── Error page ───────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 16px;
}

.error-code {
  font-size: 120px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-title { font-size: 28px; font-weight: 700; }
.error-sub { font-size: 16px; color: var(--text-muted); max-width: 360px; }

.error-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background var(--transition), box-shadow var(--transition);
}
.error-btn:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  padding: 28px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
}

.footer-brand { font-weight: 600; color: var(--text-subtle); }
.footer-sep   { color: var(--text-subtle); }
.footer-tagline { color: var(--text-subtle); }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: fadeIn 0.2s ease;
  max-width: 360px;
}
.toast.error { border-color: var(--error); color: var(--error); }

/* ── Scrollbar (global) ───────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Mobile responsive ────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 48px 16px 32px; }
  .hero-title { font-size: 36px; }
  .hero-sub { font-size: 16px; }

  .upload-card { padding: 20px 16px; }

  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .nav { padding: 0 16px; }
  .nav-logo { font-size: 16px; }

  .share-card { padding: 24px 20px; }
  .error-code { font-size: 80px; }

  .ttl-row { flex-wrap: wrap; }
  .success-actions { flex-direction: column; align-items: stretch; }
  .qr-toggle-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  .tabs { flex-direction: column; }
  .tab { text-align: center; }
}
