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

/* ─── Design tokens ──────────────────────────────────────────────── */
:root {
  /* Brand — electric blue as single dominant accent */
  --primary:    #1856FF;
  --primary-hi: #0f3fcf;
  --success:    #07CA6B;
  --danger:     #EA2143;
  --warning:    #E89558;

  /* Glass surfaces */
  --glass-bg:        rgba(255, 255, 255, 0.05);
  --glass-bg-hover:  rgba(255, 255, 255, 0.08);
  --glass-border:    rgba(255, 255, 255, 0.10);
  --glass-highlight: rgba(255, 255, 255, 0.07);

  /* Semantic feedback — adapted for dark */
  --color-loading-bg:     rgba(24, 86, 255, 0.12);
  --color-loading-border: rgba(24, 86, 255, 0.28);
  --color-loading-text:   #93b4ff;
  --color-success-bg:     rgba(7, 202, 107, 0.10);
  --color-success-border: rgba(7, 202, 107, 0.25);
  --color-success-text:   #6ee9a8;
  --color-error-bg:       rgba(234, 33, 67, 0.10);
  --color-error-border:   rgba(234, 33, 67, 0.25);
  --color-error-text:     #fca5b8;

  /* Background — near-black, barely warm */
  --bg: #0d0c10;

  /* Text — light on dark */
  --text-primary:   #eef0ff;
  --text-secondary: rgba(238, 240, 255, 0.58);
  --text-tertiary:  rgba(238, 240, 255, 0.52);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.07);
  --border-input: rgba(255, 255, 255, 0.14);

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  /* Typography */
  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Base ───────────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background-color: var(--bg);
  /* Cool-warm temperature duality: blue light source top-left, amber warmth bottom-right */
  background-image:
    radial-gradient(ellipse 100rem 80rem at 10% -10%, rgba(24, 86, 255, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 55rem 45rem  at 92% 100%, rgba(185, 95, 20, 0.07)  0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Page layout ────────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Hero ───────────────────────────────────────────────────────── */
.hero {
  padding: clamp(56px, 8vw, 80px) 24px clamp(25px, 4vw, 40px);
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 100%);
}

.hero-inner {
  max-width: 660px;
  margin: 0 auto;
  animation: fadeSlideUp 0.55s var(--ease-out) both;
}

/* Small glass chip badge — its smallness creates the scale contrast */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: 0.6875rem;        /* 11px */
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Display headline with extreme weight contrast */
.hero-title {
  display: block;
  font-family: var(--font-sans);
  font-size: clamp(2.8125rem, 8.25vw, 5.625rem);
  letter-spacing: -0.04em;
  line-height: 0.88;
  margin-bottom: 28px;
}

/* Thin line — "Steam Guide" recedes */
.hero-title-thin {
  display: block;
  font-weight: 300;
  color: var(--text-secondary);
}

/* Heavy line — "Exporter" commands */
.hero-title-bold {
  display: block;
  font-weight: 800;
  color: var(--text-primary);
}

.hero-sub {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 400px;
}

/* ─── Main content ───────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 660px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 32px) 24px clamp(48px, 6vw, 56px);
}

/* ─── Card — frosted glass panel ─────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 8px;
  /* Inner top-edge highlight — the liquidglass signature */
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 2px 8px  rgba(0, 0, 0, 0.20);
}

/* ─── Form ───────────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input {
  flex: 1;
  height: 44px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
  min-width: 0;
}

.input:focus {
  border-color: var(--primary);
  background: rgba(24, 86, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(24, 86, 255, 0.18);
}

.input::placeholder {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(234, 33, 67, 0.15);
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 8px;
  line-height: 1.5;
}

/* ─── Button — solid blue, sharp and confident ────────────────────── */
.btn {
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.2s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn:hover:not(:disabled) {
  background: var(--primary-hi);
  box-shadow: 0 4px 16px rgba(24, 86, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(24, 86, 255, 0.40);
}

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

/* Spinner */
.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { opacity: 0.75; }

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

/* ─── Status box ─────────────────────────────────────────────────── */
.status-box {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid transparent;
}

.status-box.hidden { display: none; }

.status-box.loading {
  background: var(--color-loading-bg);
  border-color: var(--color-loading-border);
  color: var(--color-loading-text);
  animation: statusAppear 0.2s var(--ease-out);
}

.status-box.success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
  animation: statusAppear 0.2s var(--ease-out);
}

.status-box.error {
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
  color: var(--color-error-text);
  animation: statusAppear 0.2s var(--ease-out);
}

/* ─── How-to ─────────────────────────────────────────────────────── */
.how-to {
  padding: 32px 0 48px;
  animation: fadeSlideUp 0.45s var(--ease-out) 0.18s both;
}

.how-to h2 {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.how-to ol {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.how-to li {
  counter-increment: steps;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Glass chip step numbers */
.how-to li::before {
  content: counter(steps);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--color-loading-bg);
  border: 1px solid var(--color-loading-border);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--color-loading-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  letter-spacing: 0;
}

.how-to li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  border-top: 1px solid var(--border);
}

/* ─── Tabs — underline on dark ───────────────────────────────────── */
.tabs {
  position: relative;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  animation: fadeSlideUp 0.4s var(--ease-out) 0.05s both;
}

.tab {
  position: relative;
  min-height: 44px;
  padding: 0 4px 12px;
  margin-right: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  display: flex;
  align-items: flex-end;
}

.tab:hover:not(.active) {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
  font-weight: 700;
}

/* Sliding indicator — positioned by JS */
.tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--primary);
  border-radius: 1px 1px 0 0;
  box-shadow: 0 0 6px rgba(24, 86, 255, 0.35);
  transition: transform 0.28s var(--ease-out), width 0.28s var(--ease-out);
  pointer-events: none;
}

.tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ─── Tab panels ─────────────────────────────────────────────────── */
.tab-panel.hidden { display: none; }

.tab-panel.tab-entering {
  animation: fadeSlideUp 0.25s var(--ease-out);
}

/* ─── Textarea ───────────────────────────────────────────────────── */
.textarea {
  width: 100%;
  height: auto;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.7;
  font-size: 0.8125rem;
}

.batch-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
}

.batch-actions .input-hint { margin-top: 0; }

/* ─── Batch progress ─────────────────────────────────────────────── */
.batch-progress {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.batch-progress.hidden { display: none; }

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.progress-bar-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}

/* Blue progress — glowing on dark */
.progress-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--primary);
  border-radius: 99px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(24, 86, 255, 0.40);
}

/* ─── Batch result list ──────────────────────────────────────────── */
.batch-results {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: min(320px, 40svh);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.10) transparent;
}

.batch-results::-webkit-scrollbar { width: 4px; }
.batch-results::-webkit-scrollbar-track { background: transparent; }
.batch-results::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); border-radius: 99px; }
.batch-results::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.20); }

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.8125rem;
  line-height: 1.4;
  animation: resultSlideIn 0.2s var(--ease-out) both;
}

.result-item.processing {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text-tertiary);
}

.result-item.success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--text-secondary);
}

.result-item.error {
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
  color: var(--text-secondary);
}

.result-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-icon .spinner {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--glass-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.result-icon .icon-success {
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.result-icon .icon-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.result-url {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-tertiary);
}

.result-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.result-error {
  font-size: 0.75rem;
  color: var(--color-error-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ─── Success download button ────────────────────────────────────── */
.btn-success {
  background: var(--success);
  width: 100%;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-success:hover:not(:disabled) {
  background: #05a859;
  box-shadow: 0 4px 16px rgba(7, 202, 107, 0.30), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-success:focus-visible {
  box-shadow: 0 0 0 3px rgba(7, 202, 107, 0.35);
}

/* ─── Misc ───────────────────────────────────────────────────────── */
.label-muted {
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
}

/* ─── Keyframes ──────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes statusAppear {
  from { opacity: 0; transform: translateY(-2px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes resultSlideIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(3px); }
}

@keyframes iconReveal {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.input.shake {
  animation: shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.icon-success,
.icon-error {
  display: inline-block;
  animation: iconReveal 0.22s var(--ease-out) both;
}

.btn-entering {
  animation: fadeSlideUp 0.3s var(--ease-out) both;
}

/* ─── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .hero { padding-left: 20px; padding-right: 20px; }
  .hero-title { letter-spacing: -0.03em; line-height: 0.9; }
  .hero-sub { max-width: 100%; }
  .main { padding-left: 20px; padding-right: 20px; }
  .card { padding: 20px 16px; }
  .input-row { flex-direction: column; }
  .batch-actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; justify-content: center; }
  .tab { margin-right: 20px; }
}

/* ─── Landscape mobile ───────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 48px; padding-bottom: 36px; }
}
