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

/* ── Tokens ── */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-2: #71717a;
  --text-3: #a1a1aa;
  --accent: #2563eb;
  --accent-h: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

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

/* ── Page shell ── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ── Dark mode ── */
[data-theme="dark"] {
  --bg: #0f0f11;
  --surface: #1a1a1f;
  --border: #2e2e36;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #52525b;
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --accent-light: #1e3a5f;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}

/* ── Header ── */
.header {
  padding: 12px 0 6px;
  text-align: center;
}

.header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.theme-toggle {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-2);
  transition: background 0.15s;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--bg);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  cursor: default;
  position: relative;
}

.logo-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.logo-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--text);
  text-transform: uppercase;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.45s cubic-bezier(0.4,0,0.2,1), opacity 0.45s ease;
}

.logo-text:first-child {
  text-align: right;
}

.logo:hover .logo-text {
  max-width: 160px;
  opacity: 1;
}

.logo-dot { color: var(--accent); }

.tagline {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 40px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.center-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 60px 32px;
}

/* ── Drop zone ── */
.upload-card {
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  border: 2px dashed var(--border);
  padding: 0;
  overflow: hidden;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.upload-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.drop-inner {
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
}

.drop-icon { font-size: 44px; line-height: 1; margin-bottom: 4px; }

.drop-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.drop-sub {
  font-size: 14px;
  color: var(--text-2);
}

.file-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.drop-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  text-align: center;
}

.hidden { display: none !important; }

/* ── File selected ── */
.file-selected {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  justify-content: center;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.file-icon { font-size: 32px; line-height: 1; }

.file-meta { flex: 1; min-width: 0; }

.file-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.btn-clear:hover { color: var(--danger); background: #fee2e2; }

.encrypt-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--success);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 500;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Buttons ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-secondary:hover { background: #dbeafe; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  background: none;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

/* ── Progress ── */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  justify-content: center;
}

.progress-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}

.progress-sub {
  font-size: 13px;
  color: var(--text-2);
}

/* ── Result ── */
.result-card { display: flex; flex-direction: column; gap: 18px; }

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.result-icon { font-size: 28px; line-height: 1; }

.result-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.result-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: block;
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.copy-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  background: var(--bg);
  min-width: 0;
}

.copy-input:focus { outline: none; border-color: var(--accent); }

.btn-copy {
  padding: 10px 18px;
  background: #27272a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-copy:hover { background: #3f3f46; }
.btn-copy.copied { background: var(--success); }

.copy-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.big-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 8px;
}

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

/* ── Loading / Error ── */
.loading-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.loading-sub {
  font-size: 13px;
  color: var(--text-2);
}

.error-card { border-color: #fecaca; }
.error-icon { font-size: 48px; }
.error-title { font-size: 18px; font-weight: 700; color: var(--danger); }
.error-sub { font-size: 14px; color: var(--text-2); max-width: 340px; }

/* ── Viewer ── */
.viewer-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewer-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-badge {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.file-badge-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.btn-download {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-download:hover { background: var(--accent-h); }

.viewer-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image viewer */
.viewer-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  margin: auto;
  padding: 20px;
}

/* Video viewer */
.viewer-content video {
  width: 100%;
  max-height: 80vh;
  display: block;
  background: #000;
}

/* Audio viewer */
.viewer-audio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 32px;
  width: 100%;
}

.viewer-audio-icon { font-size: 64px; }

.viewer-content audio {
  width: 100%;
  max-width: 480px;
}

/* PDF viewer */
.viewer-content iframe {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}

/* Text viewer */
.viewer-text {
  width: 100%;
  height: 100%;
  padding: 28px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 80vh;
  align-self: stretch;
}

/* Unknown / download fallback */
.viewer-unknown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 32px;
  text-align: center;
}

.viewer-unknown-icon { font-size: 56px; }
.viewer-unknown-title { font-size: 16px; font-weight: 600; }
.viewer-unknown-sub { font-size: 13px; color: var(--text-2); }

/* ── Footer ── */
/* ── FAQ ── */
.faq {
  width: 100%;
  margin: 30px 0 0;
  padding: 0;
}

.faq-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 12px;
  text-align: center;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.faq-item[open] {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.faq-q {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-q::-webkit-details-marker { display: none; }

.faq-q::after {
  content: '+';
  font-size: 20px;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.faq-item[open] .faq-q::after {
  transform: rotate(45deg);
}

.faq-a {
  padding: 0 20px 18px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.faq-a code {
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

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

/* ── Responsive ── */
@media (max-width: 480px) {
  .page { padding: 0 12px; }
  .card { padding: 20px; }
  .drop-inner { padding: 36px 20px; }
  .file-selected { padding: 20px; }
  .result-actions { flex-direction: column; }
  .file-badge-name { max-width: 160px; }
}
