/* ============================================================
   Byte to Byte — Polished Dark IDE Theme
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg-card:     #161b22;
  --bg-elevated: #1c2129;
  --bg-input:    #0d1117;
  --bg-hover:    #1f2937;
  --border:      #30363d;
  --border-bright:#484f58;
  --accent:      #16a34a;
  --accent-glow: rgba(22,163,74,.15);
  --accent-dark: #0f5132;
  --green:       #16a34a;
  --green-glow:  rgba(22,163,74,.15);
  --red:         #f85149;
  --yellow:      #d29922;
  --text:        #e6edf3;
  --text-dim:    #8b949e;
  --text-muted:  #484f58;
  --font-ui:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.5);
  --transition:  150ms cubic-bezier(.4,0,.2,1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-glow); color: var(--accent); }

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

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

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-radius: 8px;
  color: #fff;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.nav-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.nav-badge.accent {
  background: var(--accent-glow);
  border-color: rgba(22,163,74,.25);
  color: var(--accent);
}

.nav-help {
  font-size: 11px;
  color: var(--text-muted);
  cursor: help;
  margin-left: 6px;
}

/* ── Main Layout ───────────────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  padding: 14px 18px 10px;
  gap: 10px;
}

/* ── Language Strip ────────────────────────────────────────── */
.lang-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.lang-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 32px 7px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 150px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
select:hover  { border-color: var(--border-bright); }
select:focus  { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); outline: none; }

/* ── Swap Button ───────────────────────────────────────────── */
.swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}
.swap-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: rotate(180deg);
}
.swap-btn:active { transform: rotate(180deg) scale(.92); }

/* ── Convert Button ────────────────────────────────────────── */
.strip-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.convert-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(15,81,50,.35);
}
.convert-btn:hover  { filter: brightness(1.12); box-shadow: 0 4px 16px rgba(15,81,50,.45); transform: translateY(-1px); }
.convert-btn:active { transform: translateY(0) scale(.97); }

/* ── Auto Toggle ───────────────────────────────────────────── */
.auto-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.auto-toggle input { display: none; }
.toggle-track {
  width: 34px;
  height: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  transition: all var(--transition);
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
}
.auto-toggle input:checked + .toggle-track {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.auto-toggle input:checked + .toggle-track .toggle-thumb {
  left: 18px;
  background: var(--accent);
}
.toggle-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: .3px;
}

/* ── Editor Row ────────────────────────────────────────────── */
.editor-row {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color var(--transition);
}
.editor-panel:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.editor-panel.output       { border-radius: 0 var(--radius) var(--radius) 0; }
.editor-panel:focus-within { border-color: var(--accent); z-index: 2; }

/* ── Panel Tab ─────────────────────────────────────────────── */
.panel-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}

.tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.input-dot  { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.output-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }

.tab-lang {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.tab-actions { margin-left: auto; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.tab-btn.copied-state { color: var(--green); }

/* ── Divider ───────────────────────────────────────────────── */
.panel-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 0;
  position: relative;
  z-index: 3;
}
.divider-line { display: none; }
.divider-arrow {
  position: absolute;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  z-index: 4;
}

/* ── Editor Wrap (line numbers + textarea) ─────────────────── */
.editor-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.line-numbers {
  width: 48px;
  padding: 14px 10px 14px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  text-align: right;
  color: var(--text-muted);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
  white-space: pre-line;
}

textarea {
  flex: 1;
  background: var(--bg-input);
  color: var(--text);
  border: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  resize: none;
  outline: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  overflow-y: auto;
  tab-size: 4;
}

textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}
textarea[readonly] { color: #c9d1d9; cursor: default; }

/* ── Footer Strip ──────────────────────────────────────────── */
.footer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  min-height: 30px;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}
.status-dot.ready   { background: var(--text-dim); }
.status-dot.success { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.status-dot.warning { background: #e3a008; box-shadow: 0 0 6px rgba(227,160,8,.3); }
.status-dot.error   { background: var(--red); box-shadow: 0 0 6px rgba(248,81,73,.3); }

#statusMsg {
  font-size: 12px;
  color: var(--text-dim);
}

.warning-text {
  font-size: 11px;
  color: #e3a008;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════
   Landing Page & About Page
   ═══════════════════════════════════════════════════════════ */

.landing-body {
  overflow: auto;
  --accent:      #16a34a;
  --accent-glow: rgba(22,163,74,.15);
  --accent-dark: #0f5132;
}

.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

/* ── Animated background particles ─────────────────────────── */
.landing-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.landing-hero,
.landing-footer {
  position: relative;
  z-index: 1;
}

/* ── Hero Section ──────────────────────────────────────────── */
.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
  animation: fadeInUp 0.6s ease-out;
}

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

/* ── Brand (logo + title) ─────────────────────────────────── */
.landing-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.landing-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 0 28px rgba(22,163,74,.25);
}

.landing-title {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Description ───────────────────────────────────────────── */
.landing-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 40px;
}
.landing-desc strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────────── */
.landing-buttons {
  display: flex;
  gap: 16px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
}

.landing-btn.primary {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  box-shadow: 0 0 0 0 rgba(22,163,74,0);
}
.landing-btn.primary:hover {
  box-shadow: 0 0 24px rgba(22,163,74,.45), 0 0 60px rgba(22,163,74,.2);
  transform: translateY(-2px);
}

.landing-btn.secondary {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 0 rgba(22,163,74,0);
}
.landing-btn.secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(22,163,74,.3), 0 0 50px rgba(22,163,74,.1);
  transform: translateY(-2px);
}

/* ── Footer Languages ──────────────────────────────────────── */
.landing-footer {
  position: absolute;
  bottom: 28px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
  font-weight: 500;
}

#charCount, #conversionTime {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes pulse-green {
  0%   { box-shadow: 0 0 0 0 rgba(63,185,80,.5); }
  100% { box-shadow: 0 0 0 8px rgba(63,185,80,0); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.editor-panel { animation: fade-in .35s ease-out; }
.editor-panel.output { animation-delay: .08s; animation-fill-mode: both; }

/* ── Responsive ────────────────────────────────────────────── */

/* ── Tablet (≤860px) ── */
@media (max-width: 860px) {
  html, body { overflow: auto; }

  /* App editor */
  .editor-row      { flex-direction: column; gap: 10px; }
  .editor-panel:first-child { border-radius: var(--radius); border-right: 1px solid var(--border); }
  .editor-panel.output       { border-radius: var(--radius); }
  .panel-divider   { display: none; }
  .lang-strip      { flex-wrap: wrap; gap: 8px; }
  .strip-right     { margin-left: 0; width: 100%; justify-content: space-between; }
  .convert-btn     { flex: 1; justify-content: center; }
  main             { height: auto; overflow-y: auto; padding: 10px 12px; }
  textarea         { min-height: 200px; font-size: 13px; }
  .navbar          { padding: 0 14px; }
  .nav-help        { display: none; }

  /* Landing page */
  .landing         { padding: 32px 20px 80px; }
  .landing-hero    { max-width: 100%; }
  .landing-brand   { gap: 12px; margin-bottom: 20px; }
  .landing-logo    { width: 56px; height: 56px; }
  .landing-title   { font-size: 34px; }
  .landing-desc    { font-size: 15px; margin-bottom: 28px; }
  .landing-buttons { flex-wrap: wrap; gap: 12px; justify-content: center; }
  .landing-btn     { padding: 12px 28px; font-size: 14px; }
}

/* ── Mobile (≤600px) ── */
@media (max-width: 600px) {
  /* App editor */
  main             { padding: 8px 10px; gap: 8px; }
  .lang-strip      { padding: 8px 10px; }
  .lang-picker     { gap: 5px; }
  .picker-label    { font-size: 9px; }
  select           { min-width: 0; width: 100%; font-size: 13px; padding: 9px 28px 9px 10px; }
  .lang-strip .lang-picker { flex: 1; flex-direction: column; align-items: flex-start; }
  .swap-btn        { align-self: center; }
  .convert-btn     { padding: 10px 16px; font-size: 13px; }
  textarea         { min-height: 180px; font-size: 13px; padding: 10px 12px; }
  .footer-strip    { flex-wrap: wrap; gap: 4px; padding: 5px 10px; }
  .status-right    { display: none; }

  /* Navbar */
  .navbar          { padding: 0 12px; height: 46px; }
  .brand-name      { font-size: 15px; }
  .brand-icon      { width: 30px; height: 30px; }
  .nav-badge       { display: none; }

  /* Landing */
  .landing         { padding: 28px 16px 72px; }
  .landing-brand   { flex-direction: column; gap: 10px; }
  .landing-logo    { width: 52px; height: 52px; }
  .landing-title   { font-size: 28px; }
  .landing-desc    { font-size: 14px; margin-bottom: 24px; }
  .landing-buttons { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 280px; }
  .landing-btn     { padding: 13px 20px; font-size: 14px; justify-content: center; }
  .landing-footer  { font-size: 10px; bottom: 16px; padding: 0 12px; text-align: center; }
}

/* ── Small mobile (≤400px) ── */
@media (max-width: 400px) {
  .landing-title   { font-size: 24px; }
  .landing-logo    { width: 44px; height: 44px; }
  textarea         { min-height: 150px; font-size: 12px; }
  .line-numbers    { width: 36px; font-size: 11px; }
}
