/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #05050a;
  --surface: #0d0d1a;
  --surface-2: #13131f;
  --surface-3: #1a1a2e;
  --border: rgba(255,255,255,0.07);
  --border-glow: rgba(139,92,246,0.35);
  --text-primary: #f0eeff;
  --text-secondary: #8b8aac;
  --text-muted: #4d4d6b;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-glow: rgba(139,92,246,0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6,182,212,0.2);
  --green: #10b981;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== BACKGROUND ORBS ===== */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
  top: -200px; left: -150px;
  animation-duration: 15s;
}

.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  bottom: -150px; right: -100px;
  animation-duration: 18s;
  animation-delay: -6s;
}

.orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #ec4899, transparent 70%);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 20s;
  animation-delay: -10s;
  opacity: 0.18;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  33% { transform: translateY(-30px) scale(1.05); }
  66% { transform: translateY(20px) scale(0.95); }
}

/* ===== NOISE TEXTURE ===== */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ===== PAGE LAYOUT ===== */
.page {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  animation: pageIn 0.8s ease both;
}

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

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 60px;
  animation: pageIn 0.6s ease both;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  background: linear-gradient(90deg, var(--text-primary), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--surface);
}

/* ===== HERO ===== */
.hero {
  margin-bottom: 48px;
  animation: pageIn 0.7s ease 0.1s both;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s ease infinite;
}

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

.hero-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.hero-title em {
  font-style: italic;
  background: linear-gradient(90deg, var(--accent-2), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 420px;
}

/* ===== MAIN CARD ===== */
.main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(40px);
  animation: pageIn 0.7s ease 0.2s both;
  position: relative;
  overflow: hidden;
}

.main-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
  opacity: 0.6;
}

/* ===== CONFIG SECTION ===== */
.config-section {
  margin-bottom: 28px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.2s;
  outline: none;
}

.input-wrap input::placeholder { color: var(--text-muted); }

.input-wrap input:focus {
  border-color: var(--border-glow);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 28px;
}

/* ===== TRANSLATE GRID ===== */
.translate-grid {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  gap: 0;
  align-items: stretch;
  margin-bottom: 24px;
}

/* ===== LANG PANEL ===== */
.lang-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s;
}

.lang-panel:hover { border-color: rgba(255,255,255,0.12); }
.lang-panel--output { background: rgba(6,182,212,0.03); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.lang-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  flex: 1;
}

.lang-select option { background: #1a1a2e; color: var(--text-primary); }

.char-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

.copy-btn:hover {
  color: var(--accent-2);
  border-color: var(--border-glow);
}

#textInput {
  flex: 1;
  min-height: 160px;
  background: transparent;
  border: none;
  padding: 16px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
  resize: none;
  outline: none;
}

#textInput::placeholder { color: var(--text-muted); }

.output-area {
  flex: 1;
  min-height: 160px;
  padding: 16px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-primary);
  overflow-y: auto;
}

.output-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.translating {
  color: var(--accent-2);
}

.dots span {
  animation: blink 1.4s ease infinite;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.panel-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.file-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.file-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.15);
}

#fileInput { display: none; }

.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.clear-btn:hover {
  color: #ef4444;
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.05);
}

/* ===== CONFIDENCE BAR ===== */
.confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.confidence-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 2px;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.confidence-val {
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 500;
  min-width: 36px;
  text-align: right;
}

/* ===== SWAP COLUMN ===== */
.swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.swap-btn {
  width: 36px; height: 36px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  flex-shrink: 0;
}

.swap-btn:hover {
  background: var(--surface);
  border-color: var(--border-glow);
  color: var(--accent-2);
  transform: rotate(180deg);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ===== ACTION ROW ===== */
.action-row {
  display: flex;
  justify-content: center;
}

.translate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 50%, var(--cyan) 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.translate-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.translate-btn:hover::after { opacity: 1; }

.translate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139,92,246,0.5), 0 0 60px rgba(6,182,212,0.15);
}

.translate-btn:active { transform: translateY(0); }
.translate-btn:disabled { opacity: 0.7; transform: none; cursor: wait; }

.btn-text, .btn-loader {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spin {
  animation: spin 1s linear infinite;
}

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

/* ===== FEATURES ===== */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
  animation: pageIn 0.7s ease 0.4s both;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.25s;
}

.feature:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  background: var(--surface-2);
}

.feature-icon {
  width: 36px; height: 36px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
  flex-shrink: 0;
}

.feature-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.feature-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 680px) {
  .translate-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .swap-col {
    padding: 4px;
    transform: rotate(90deg);
  }

  .config-row {
    grid-template-columns: 1fr;
  }

  .features {
    grid-template-columns: 1fr 1fr;
  }

  .main-card { padding: 20px 16px; }

  .hero-title { font-size: 36px; }
}

@media (max-width: 420px) {
  .features { grid-template-columns: 1fr; }
}
