/* ═══════════════════════════════════════════════════════════════
   Hodyn Transfer — Private E2E Encrypted File Transfer
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #0f0f13;
  --bg-card: #1a1a24;
  --bg-card-hover: #22222e;
  --bg-input: #12121a;
  --border: #2a2a3a;
  --border-focus: #5b6ef5;
  --text: #e4e4ec;
  --text-secondary: #9090a8;
  --text-muted: #606078;
  --primary: #5b6ef5;
  --primary-hover: #6d7ef7;
  --primary-bg: rgba(91, 110, 245, 0.12);
  --danger: #e0556a;
  --danger-bg: rgba(224, 85, 106, 0.12);
  --success: #3ec97e;
  --success-bg: rgba(62, 201, 126, 0.12);
  --warning: #f0a040;
  --warning-bg: rgba(240, 160, 64, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Top Bar ─────────────────────────────────────────────────── */

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}
.topbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.topbar-brand span {
  color: var(--primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.font-ctrl {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.font-ctrl .btn {
  border-radius: 0;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}
.font-ctrl .btn:hover {
  background: var(--primary-bg);
}

@media (max-width: 480px) {
  .topbar-inner { padding: 10px 14px; }
  .topbar-brand { font-size: 16px; }
  .topbar-user { display: none; }
  .font-ctrl { display: none; }
}

/* ─── Layout ──────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 640px;
  padding: 24px 20px;
  flex: 1;
}

.header {
  text-align: center;
  padding: 32px 0 24px;
}

.logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--primary);
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Cards ───────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}

.card-header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ─── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 6px 12px;
}
.btn-ghost:hover {
  background: var(--primary-bg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Form ────────────────────────────────────────────────────── */

.input, .textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.input:focus, .textarea:focus {
  border-color: var(--border-focus);
}
.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 16px;
}

/* ─── Drop Zone ───────────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}
.drop-zone-text {
  font-size: 15px;
  color: var(--text-secondary);
}
.drop-zone-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.file-selected {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.file-selected.active {
  display: flex;
}
.file-selected-icon {
  font-size: 28px;
}
.file-selected-info {
  flex: 1;
  min-width: 0;
}
.file-selected-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-selected-size {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Tabs (Text / File) ──────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.tab {
  flex: 1;
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: inherit;
}
.tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ─── Expiry Selector ─────────────────────────────────────────── */

.expiry-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.expiry-option {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.expiry-option:hover {
  border-color: var(--text-secondary);
}
.expiry-option.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

/* ─── Toggle / Checkbox ───────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.toggle-label {
  font-size: 14px;
}
.toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
}
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.password-input-wrap {
  margin-top: 8px;
  display: none;
}
.password-input-wrap.active {
  display: block;
}

/* ─── Progress ────────────────────────────────────────────────── */

.progress-wrap {
  display: none;
  margin-top: 16px;
}
.progress-wrap.active {
  display: block;
}
.progress-bar-outer {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}
.progress-steps {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ─── Result ──────────────────────────────────────────────────── */

.result-wrap {
  display: none;
  margin-top: 20px;
}
.result-wrap.active {
  display: block;
}
.result-card {
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.result-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.result-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--success);
}
.result-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
}
.result-link-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

/* ─── QR Code ─────────────────────────────────────────────────── */

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
.qr-wrap canvas {
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
}

/* ─── Download Page ───────────────────────────────────────────── */

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.file-info-icon {
  font-size: 36px;
}
.file-info-detail {
  flex: 1;
  min-width: 0;
}
.file-info-name {
  font-size: 16px;
  font-weight: 600;
  word-break: break-all;
}
.file-info-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.expiry-countdown {
  font-size: 14px;
  color: var(--warning);
  padding: 8px 14px;
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-top: 12px;
}
.expiry-countdown.expired {
  color: var(--danger);
  background: var(--danger-bg);
}

.burn-warning {
  font-size: 13px;
  color: var(--danger);
  padding: 10px 14px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-top: 12px;
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

/* ─── Footer ──────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}
.footer a:hover {
  color: var(--primary);
}

.lock-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-size: 12px;
}

/* ─── Utilities ───────────────────────────────────────────────── */

.hidden {
  display: none !important;
}
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ─── Spinner ─────────────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ─── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .header { padding: 20px 0 16px; }
  .logo { font-size: 24px; }
  .btn-lg { padding: 12px 20px; font-size: 15px; }
  .expiry-option { padding: 6px 12px; font-size: 12px; }
  .drop-zone { padding: 32px 16px; }
}

/* ─── Animations ──────────────────────────────────────────────── */

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

.card, .result-card {
  animation: fadeIn 0.3s ease;
}

/* ─── Modal / Confirm Dialog ──────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
.modal-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Toast ───────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
  pointer-events: none;
}
