/* ── Reset & Base ───────────────────────────────────────────────── */
:root {
  --bg:        #0e0e0f;
  --bg-sub:    #141416;
  --surface:   #1a1a1d;
  --surface2:  #222226;
  --surface3:  #2a2a2e;
  --border:    #2e2e33;
  --border2:   #3d3d44;
  --muted:     #555560;
  --sub:       #7a7a88;
  --text:      #c8c8d4;
  --bright:    #f0f0f4;
  --white:     #ffffff;
  --accent:    #e8e8f0;
  --success:   #4caf82;
  --danger:    #e05555;
  --warn:      #e09050;
  --r-sm:      6px;
  --r:         10px;
  --r-lg:      14px;
  --r-xl:      18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* subtle radial bg texture */
  background-image: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255,255,255,0.03) 0%, transparent 70%);
}
.mono { font-family: 'Space Mono', monospace !important; }

/* ── Nav ────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(14,14,15,0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-img-wrap {
  width: 30px; height: 30px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--bright);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.logo-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.logo-default-icon { flex-shrink: 0; }
.logo-name { font-size: 15px; font-weight: 700; color: var(--bright); letter-spacing: -0.2px; }
.nav-tagline { font-size: 12px; color: var(--muted); }

/* ── Layout ─────────────────────────────────────────────────────── */
.main {
  max-width: 680px;
  margin: 0 auto;
  padding: 36px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Panel (card) ───────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.2s;
}
.panel:hover { box-shadow: var(--shadow); }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.panel-title { font-size: 15px; font-weight: 600; color: var(--bright); }
.panel-sub { font-size: 13px; color: var(--sub); margin-top: 3px; }

.section-title { font-size: 13px; font-weight: 600; color: var(--bright); }
.section-sub { font-size: 12px; color: var(--muted); }

/* ── Mode toggle ────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.mode-btn {
  padding: 5px 14px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: all 0.15s;
  letter-spacing: 0.1px;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--surface2); border-color: var(--border2); color: var(--bright); }

/* ── Drop Zone ──────────────────────────────────────────────────── */
.drop-zone {
  border: 1px dashed var(--border2);
  border-radius: var(--r-lg);
  min-height: 180px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s;
}
.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 100%, rgba(255,255,255,0.025) 0%, transparent 70%);
  pointer-events: none;
}
.drop-zone:hover { border-color: var(--border2); background: rgba(255,255,255,0.015); }
.drop-zone.hovering { border-color: var(--accent); border-style: solid; background: rgba(255,255,255,0.03); }

.dz-idle, .dz-over {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  padding: 36px 24px;
  text-align: center;
  width: 100%;
  pointer-events: none;
}
.dz-icon {
  width: 48px; height: 48px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  margin-bottom: 8px;
  transition: all 0.18s;
}
.drop-zone:hover .dz-icon { color: var(--text); border-color: var(--border2); }
.drop-zone.hovering .dz-icon,
.dz-icon.active { border-color: var(--accent); color: var(--bright); background: rgba(255,255,255,0.06); }
.dz-title { font-size: 14px; font-weight: 600; color: var(--bright); }
.dz-hint { font-size: 13px; color: var(--sub); pointer-events: all; }
.dz-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── File Queue ─────────────────────────────────────────────────── */
.file-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.file-item.uploading { border-color: var(--border2); }
.file-item.done { border-color: rgba(76,175,130,0.3); }
.file-item.failed { border-color: rgba(224,85,85,0.3); }

/* per-file progress bar bg */
.file-item-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.04);
  transition: width 0.2s ease;
  pointer-events: none;
  border-radius: var(--r) 0 0 var(--r);
}

.file-thumb {
  width: 38px; height: 38px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 1;
}
.file-thumb img, .file-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.file-thumb-icon { font-size: 18px; line-height: 1; }

.file-item-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.file-item-name { font-size: 13px; font-weight: 500; color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; }

.file-item-status {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.uploading { background: var(--warn); animation: pulse-dot 1s infinite; }
.status-dot.done { background: var(--success); }
.status-dot.failed { background: var(--danger); }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

.file-remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 2px 4px;
  border-radius: 4px; font-size: 16px; line-height: 1;
  transition: color 0.12s, background 0.12s;
  position: relative; z-index: 1;
}
.file-remove-btn:hover { color: var(--danger); background: rgba(224,85,85,0.1); }

/* ── Options row ────────────────────────────────────────────────── */
.options-row { display: flex; flex-wrap: wrap; gap: 10px; }
.option-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 180px; }
.option-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}
.option-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.option-input:focus { border-color: var(--border2); }
.option-input::placeholder { color: var(--muted); }

/* ── Upload row ─────────────────────────────────────────────────── */
.upload-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

/* ── Overall progress ───────────────────────────────────────────── */
.overall-progress { display: flex; flex-direction: column; gap: 8px; }
.op-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); }
.op-label {}
.op-count { color: var(--muted); }
.progress-track { height: 3px; background: var(--surface3); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.25s ease;
}

/* ── Error bar ──────────────────────────────────────────────────── */
.error-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: rgba(224,85,85,0.08);
  border: 1px solid rgba(224,85,85,0.22);
  border-radius: var(--r-sm);
  font-size: 13px; color: #e07070;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  background: var(--bright);
  color: #0e0e0f;
  border: none;
  border-radius: var(--r-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.btn-primary:hover { background: var(--white); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.w-full { width: 100%; justify-content: center; }

.btn-ghost-sm {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.btn-ghost-sm:hover { color: var(--text); border-color: var(--border2); }

.link-btn {
  background: none; border: none;
  color: var(--text);
  font-family: inherit; font-size: inherit;
  cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  pointer-events: all;
  padding: 0;
}
.link-btn:hover { color: var(--bright); }

.link-btn-sm {
  background: none; border: none;
  color: var(--muted);
  font-family: 'Inter', sans-serif; font-size: 12px;
  cursor: pointer;
  transition: color 0.12s;
  padding: 0;
}
.link-btn-sm:hover { color: var(--text); }

.btn-copy {
  padding: 6px 12px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.btn-copy:hover { background: var(--surface2); color: var(--bright); }
.btn-copy.copied { color: var(--success); border-color: rgba(76,175,130,0.3); }

/* ── Result cards ───────────────────────────────────────────────── */
.results-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
  animation: fadeUp 0.22s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.rc-header { display: flex; align-items: center; gap: 12px; }
.rc-check {
  width: 32px; height: 32px;
  background: rgba(76,175,130,0.12);
  border: 1px solid rgba(76,175,130,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--success); flex-shrink: 0;
}
.rc-meta { flex: 1; min-width: 0; }
.rc-filename { font-size: 13px; font-weight: 600; color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-info { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.rc-timer {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-family: 'Space Mono', monospace;
  color: var(--sub); flex-shrink: 0;
}
.rc-timer.urgent { color: var(--warn); }

.rc-share { display: flex; flex-direction: column; gap: 6px; }
.rc-share-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.rc-link-row { display: flex; gap: 6px; }
.rc-input {
  flex: 1; min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: 'Space Mono', monospace;
  font-size: 11px; color: var(--text);
  outline: none;
}
.rc-code-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}
.rc-code-value { flex: 1; font-family: 'Space Mono', monospace; font-size: 14px; font-weight: 700; color: var(--bright); word-break: break-all; }

.rc-stats { display: flex; gap: 14px; }
.rc-stat { display: flex; flex-direction: column; gap: 2px; }
.rc-stat-val { font-size: 18px; font-weight: 700; color: var(--bright); line-height: 1; }
.rc-stat-label { font-size: 11px; color: var(--muted); }

.rc-qr {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.qr-canvas { border-radius: var(--r-sm); background: white; padding: 8px; }

.rc-note { font-size: 11px; color: var(--muted); line-height: 1.5; }

.rc-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.rc-actions { display: flex; gap: 8px; }
.btn-new-upload {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.btn-new-upload:hover { color: var(--text); border-color: var(--border2); }

/* ── Bottom grid ────────────────────────────────────────────────── */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) { .bottom-grid { grid-template-columns: 1fr; } }

.retrieve-panel, .history-panel { gap: 10px; }

.retrieve-row { display: flex; gap: 6px; flex-direction: column; }
.text-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.text-input:focus { border-color: var(--border2); }
.text-input::placeholder { color: var(--muted); }
.text-input.mono { font-family: 'Space Mono', monospace; font-size: 11px; }

.result-slot { display: flex; flex-direction: column; gap: 8px; }
.rs-name { font-size: 13px; font-weight: 600; color: var(--bright); word-break: break-all; }
.rs-meta { font-size: 11px; color: var(--muted); }
.rs-pw-row { display: flex; flex-direction: column; gap: 6px; }
.rs-pw-note { font-size: 12px; color: var(--sub); }

/* ── History ────────────────────────────────────────────────────── */
.history-header { display: flex; align-items: center; justify-content: space-between; }
.history-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

.history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.history-item:hover { border-color: var(--border2); background: var(--surface3); }
.history-item-icon { font-size: 16px; flex-shrink: 0; }
.history-item-info { flex: 1; min-width: 0; }
.history-item-name { font-size: 12px; font-weight: 500; color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
.history-item-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface3);
  color: var(--muted);
  flex-shrink: 0;
}
.history-item-badge.expired { color: var(--danger); background: rgba(224,85,85,0.1); }

.empty-state { font-size: 12px; color: var(--muted); text-align: center; padding: 20px 0; }

/* ── Download result (retrieve) ─────────────────────────────────── */
.dl-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.dl-card-name { font-size: 13px; font-weight: 600; color: var(--bright); word-break: break-all; }
.dl-card-meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.btn-download {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px;
  background: var(--bright);
  color: #0e0e0f;
  text-decoration: none;
  border-radius: var(--r-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  transition: background 0.12s, transform 0.1s;
  border: none; cursor: pointer;
}
.btn-download:hover { background: var(--white); transform: translateY(-1px); }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 28px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

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

@media (max-width: 480px) {
  .nav { padding: 0 16px; }
  .main { padding: 24px 14px 60px; }
  .panel { padding: 16px; }
  .panel-header { flex-direction: column; gap: 10px; }
}