@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg: #f0f2f8;
  --surface: #ffffff;
  --border: #e2e6f0;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --error: #dc2626;
  --error-light: #fef2f2;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.12);
  --transition: 0.18s ease;
}

html, body { height: 100%; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Header ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Language switcher (app page) ── */
.lang-sw {
  display: flex;
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.lang-sw button {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 4px 8px; border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.lang-sw button:hover { color: var(--text); }
.lang-sw button.active {
  background: var(--primary);
  color: #fff;
}

/* Logo now also acts as a link */
.logo { text-decoration: none; cursor: pointer; }
.logo:hover .logo-text { color: var(--primary); }

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 26px;
  height: 26px;
  color: var(--primary);
}
.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.1px;
}

/* ── Main ── */
.main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ── Hero ── */
.hero {
  margin-bottom: 32px;
  text-align: center;
}
.hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
}

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Sections inside card ── */
.section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }
.section-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfd;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-content {
  text-align: center;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.drop-icon {
  width: 40px;
  height: 40px;
  color: var(--text-light);
  margin-bottom: 4px;
}
.drop-main {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.drop-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.browse-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.browse-btn:hover { color: var(--primary-dark); }

/* File selected state */
.file-selected {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.file-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  flex-shrink: 0;
}
.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 12px;
  color: var(--text-muted);
}
.remove-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.remove-btn:hover { color: var(--error); background: var(--error-light); }

/* ── Language select ── */
.select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
}
.lang-select {
  width: 100%;
  appearance: none;
  background: #fafbfd;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 40px 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lang-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.select-arrow {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Translate button ── */
.section-action {
  display: flex;
  justify-content: flex-end;
  padding: 20px 28px;
}
.translate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.translate-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.translate-btn:active:not(:disabled) { transform: translateY(0); }
.translate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Progress ── */
.progress-section { display: flex; flex-direction: column; gap: 16px; }

.progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.step span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: color var(--transition);
}
.step.active span { color: var(--primary); }
.step.done span { color: var(--success); }

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.step.active .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.step.active .step-dot::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: white;
  animation: pulse-dot 1.2s ease infinite;
}
.step.done .step-dot {
  background: var(--success);
  border-color: var(--success);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.5); }
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  margin-bottom: 22px;
  transition: background var(--transition);
}
.step-line.done { background: var(--success); }

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}
.progress-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}
.progress-msg {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Error ── */
.error-section { padding: 20px 28px; }
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--error-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
}
.error-box svg { flex-shrink: 0; margin-top: 1px; }

/* ── Download ── */
.download-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px;
}
.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-light);
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 99px;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}
.download-btn:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4);
}
.new-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.new-btn:hover { color: var(--text); }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 18px 24px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

/* ── Utilities ── */
[hidden] { display: none !important; }
