/* ============================================================
   BaminiConvert — Premium Dark/Light UI with i18n
   ============================================================ */

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

:root {
  /* Colors — Dark (default) */
  --col-bg:        #0a0c14;
  --col-surface:   #111320;
  --col-surface-2: #181b2d;
  --col-surface-3: #1e2238;
  --col-border:    rgba(255,255,255,0.07);
  --col-border-hi: rgba(255,255,255,0.14);

  --col-primary:   #7c6aff;
  --col-primary-2: #a78bfa;
  --col-accent:    #f97316;
  --col-accent-2:  #fb923c;

  --col-text:      #e2e8f0;
  --col-text-sub:  #94a3b8;
  --col-text-dim:  #475569;

  --col-success:   #22c55e;
  --col-error:     #ef4444;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #7c6aff 0%, #a78bfa 50%, #f97316 100%);
  --grad-card:    linear-gradient(145deg, #181b2d 0%, #1e2238 100%);
  --grad-btn:     linear-gradient(135deg, #7c6aff, #6d5ce7);

  /* Spacing */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadows */
  --shadow-card:    0 4px 24px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-glow:    0 0 40px rgba(124,106,255,0.25);
  --shadow-btn:     0 4px 20px rgba(124,106,255,0.4);

  /* Fonts */
  --font-body: 'Inter', system-ui, sans-serif;
  --font-tamil: 'Noto Sans Tamil', 'Latha', serif;

  /* Header bg (dark) */
  --col-header-bg: rgba(10,12,20,0.75);
  --col-panel-footer: rgba(0,0,0,0.12);
  --col-panel-header: rgba(255,255,255,0.02);
  --col-example-label: rgba(255,255,255,0.02);
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --col-bg:        #f0f2f8;
  --col-surface:   #ffffff;
  --col-surface-2: #f4f5fb;
  --col-surface-3: #e8eaf4;
  --col-border:    rgba(0,0,0,0.08);
  --col-border-hi: rgba(0,0,0,0.16);

  --col-primary:   #6354e8;
  --col-primary-2: #7c6aff;
  --col-accent:    #e8620a;
  --col-accent-2:  #f97316;

  --col-text:      #1a1d2e;
  --col-text-sub:  #4a5568;
  --col-text-dim:  #94a3b8;

  --col-success:   #16a34a;
  --col-error:     #dc2626;

  --grad-card:    linear-gradient(145deg, #ffffff 0%, #f4f5fb 100%);
  --grad-btn:     linear-gradient(135deg, #6354e8, #7c6aff);

  --shadow-card:    0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-glow:    0 0 40px rgba(99,84,232,0.12);
  --shadow-btn:     0 4px 20px rgba(99,84,232,0.35);

  --col-header-bg: rgba(240,242,248,0.85);
  --col-panel-footer: rgba(0,0,0,0.03);
  --col-panel-header: rgba(0,0,0,0.02);
  --col-example-label: rgba(0,0,0,0.02);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--col-bg);
  color: var(--col-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---------- Animated background glows ---------- */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  animation: glow-drift 18s ease-in-out infinite alternate;
  transition: background 0.5s;
}
.bg-glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,106,255,0.18), transparent 70%);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.bg-glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(249,115,22,0.12), transparent 70%);
  top: 40%; right: -150px;
  animation-delay: -6s;
}
.bg-glow-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(167,139,250,0.1), transparent 70%);
  bottom: 10%; left: 30%;
  animation-delay: -12s;
}
[data-theme="light"] .bg-glow-1 {
  background: radial-gradient(circle, rgba(99,84,232,0.10), transparent 70%);
}
[data-theme="light"] .bg-glow-2 {
  background: radial-gradient(circle, rgba(232,98,10,0.07), transparent 70%);
}
[data-theme="light"] .bg-glow-3 {
  background: radial-gradient(circle, rgba(124,106,255,0.06), transparent 70%);
}
@keyframes glow-drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(40px,60px) scale(1.08); }
  100% { transform: translate(-30px,30px) scale(0.94); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--col-header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--col-border);
  transition: background 0.3s;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  background: var(--grad-primary);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-family: var(--font-tamil);
  font-size: 20px;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-btn);
  flex-shrink: 0;
}
.logo-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--col-text);
  display: block;
  line-height: 1.2;
}
.logo-sub {
  font-size: 11px;
  color: var(--col-text-sub);
  display: block;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--col-text-sub);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover { color: var(--col-text); background: var(--col-surface-2); }
.nav-link--external {
  border: 1px solid var(--col-border);
  margin-left: 6px;
}

/* Theme & Language toggle buttons */
.btn-theme-toggle,
.btn-lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--col-text-sub);
  background: var(--col-surface-2);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin-left: 4px;
}
.btn-theme-toggle:hover,
.btn-lang-toggle:hover {
  color: var(--col-text);
  background: var(--col-surface-3);
  border-color: var(--col-border-hi);
}
.btn-theme-toggle:active,
.btn-lang-toggle:active { transform: scale(0.96); }
.btn-theme-toggle svg,
.btn-lang-toggle svg { flex-shrink: 0; }
.btn-lang-toggle .lang-label-ta {
  font-family: var(--font-tamil);
  font-size: 14px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  padding: 80px 24px 48px;
  text-align: center;
}
.hero-content { max-width: 700px; margin: 0 auto; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(124,106,255,0.12);
  border: 1px solid rgba(124,106,255,0.3);
  border-radius: 100px;
  font-size: 13px;
  color: var(--col-primary-2);
  font-weight: 500;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.badge-dot {
  width: 7px; height: 7px;
  background: var(--col-success);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.hero-title {
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--col-text);
}
.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 18px;
  color: var(--col-text-sub);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Converter Section ---------- */
.converter-section {
  position: relative;
  z-index: 1;
  padding: 0 24px 80px;
}
.converter-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-md);
  padding: 14px 28px;
  width: fit-content;
  margin: 0 auto;
  box-shadow: var(--shadow-card);
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--col-primary-2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: all 0.3s;
}
.stat-label {
  font-size: 11px;
  color: var(--col-text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--col-border);
}

/* Converter grid */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 16px;
  align-items: start;
}

/* Panels */
.panel {
  background: var(--grad-card);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.panel:hover {
  border-color: var(--col-border-hi);
}
.panel--input:focus-within {
  border-color: rgba(124,106,255,0.5);
  box-shadow: var(--shadow-card), 0 0 0 3px rgba(124,106,255,0.08);
}
.panel--output:focus-within {
  border-color: rgba(249,115,22,0.4);
  box-shadow: var(--shadow-card), 0 0 0 3px rgba(249,115,22,0.06);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--col-border);
  background: var(--col-panel-header);
}
.panel-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--col-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.panel-icon { font-size: 16px; }

.panel-actions { display: flex; gap: 6px; }

.btn-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--col-text-sub);
  background: transparent;
  border: 1px solid var(--col-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-icon:hover {
  background: var(--col-surface-3);
  color: var(--col-text);
  border-color: var(--col-border-hi);
}
.btn-icon:active { transform: scale(0.97); }

/* Textarea */
.text-area {
  width: 100%;
  min-height: 280px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 15px;
  line-height: 1.7;
  color: var(--col-text);
  padding: 18px 20px;
  display: block;
}
.text-area::placeholder { color: var(--col-text-dim); }

.text-area--output {
  font-family: var(--font-tamil), var(--font-body);
  font-size: 16px;
  overflow-y: auto;
  cursor: default;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 280px;
  padding: 18px 20px;
}

/* Output placeholder */
.output-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: var(--col-text-dim);
  text-align: center;
  gap: 8px;
}
.placeholder-icon {
  font-family: var(--font-tamil);
  font-size: 56px;
  color: rgba(124,106,255,0.2);
  line-height: 1;
  margin-bottom: 8px;
}
.output-placeholder p { font-size: 15px; }
.placeholder-sub { font-size: 13px; }

/* Panel footer */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--col-border);
  background: var(--col-panel-footer);
}
.char-count {
  font-size: 12px;
  color: var(--col-text-dim);
  font-variant-numeric: tabular-nums;
}
.copy-status {
  font-size: 12px;
  color: var(--col-success);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
}
.copy-status.visible { opacity: 1; }

/* Toggle */
.option-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--col-text-sub);
  cursor: pointer;
  user-select: none;
}
.option-toggle input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--col-surface-3);
  border-radius: 100px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid var(--col-border);
}
.option-toggle input:checked + .toggle-track {
  background: var(--col-primary);
  border-color: var(--col-primary);
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.option-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

/* Center convert button */
.center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 80px;
}
.btn-convert {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--grad-btn);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s, box-shadow 0.2s;
  color: white;
  position: relative;
  overflow: hidden;
}
.btn-convert::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
  border-radius: 50%;
}
.btn-convert:hover::before { background: rgba(255,255,255,0.12); }
.btn-convert:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(124,106,255,0.55); }
.btn-convert:active { transform: scale(0.97); }

.btn-convert-icon { font-size: 22px; font-weight: 700; line-height: 1; }
.btn-convert-label { font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }

.convert-hint {
  font-size: 11px;
  color: var(--col-text-dim);
  text-align: center;
  line-height: 1.5;
}
kbd {
  display: inline-block;
  background: var(--col-surface-2);
  border: 1px solid var(--col-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-body);
  color: var(--col-text-sub);
}

/* Options row */
.options-row {
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.option-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--col-text-sub);
  white-space: nowrap;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--col-text-sub);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--col-border);
  transition: all 0.2s;
  user-select: none;
}
.radio-option:hover { background: var(--col-surface-2); color: var(--col-text); }
.radio-option input { display: none; }
.radio-custom {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--col-border-hi);
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.radio-option input:checked ~ .radio-custom {
  border-color: var(--col-primary);
}
.radio-option input:checked ~ .radio-custom::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 6px; height: 6px;
  background: var(--col-primary);
  border-radius: 50%;
}
.radio-option:has(input:checked) {
  background: rgba(124,106,255,0.1);
  border-color: rgba(124,106,255,0.3);
  color: var(--col-text);
}

/* ---------- Info sections ---------- */
.info-section {
  position: relative;
  z-index: 1;
  padding: 80px 24px;
}
.info-section--alt {
  background: rgba(255,255,255,0.015);
}
[data-theme="light"] .info-section--alt {
  background: rgba(0,0,0,0.025);
}
.info-container {
  max-width: 1100px;
  margin: 0 auto;
}
.section-title {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 700;
  margin-bottom: 48px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* Info cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.info-card {
  background: var(--grad-card);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.info-card:hover {
  border-color: rgba(124,106,255,0.35);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 8px 32px rgba(124,106,255,0.1);
}
.info-card-icon { font-size: 32px; margin-bottom: 16px; }
.info-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--col-text);
}
.info-card p {
  font-size: 14px;
  color: var(--col-text-sub);
  line-height: 1.7;
}
.info-card p em { color: var(--col-primary-2); font-style: normal; }

/* About section */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.about-text p {
  font-size: 15px;
  color: var(--col-text-sub);
  line-height: 1.75;
  margin-bottom: 16px;
}
.about-text strong { color: var(--col-text); }

.about-example {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.example-box {
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.example-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--col-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--col-border);
  background: var(--col-example-label);
}
.example-content {
  padding: 16px;
  font-size: 15px;
  line-height: 1.6;
}
.example-content--bamini {
  font-family: 'Courier New', monospace;
  color: var(--col-text-sub);
  font-size: 13px;
  word-break: break-all;
}
.example-content--unicode {
  font-family: var(--font-tamil);
  font-size: 17px;
  color: var(--col-text);
}
.example-arrow {
  font-size: 28px;
  text-align: center;
  color: var(--col-primary);
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--col-border);
  padding: 36px 24px;
  text-align: center;
}
.footer-inner { max-width: 900px; margin: 0 auto; }
.site-footer p { font-size: 14px; color: var(--col-text-dim); }
.site-footer a { color: var(--col-primary-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-sub { margin-top: 8px; font-size: 13px; }

/* ---------- Animations ---------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel, .stats-bar, .options-row {
  animation: fade-in-up 0.5s ease both;
}
.panel--output { animation-delay: 0.1s; }
.options-row   { animation-delay: 0.2s; }

/* Converting animation on button */
.btn-convert.converting {
  animation: spin-pulse 0.8s ease-in-out;
}
@keyframes spin-pulse {
  0%   { transform: scale(1) rotate(0deg); }
  50%  { transform: scale(1.12) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* Output has content */
.text-area--output.has-content {
  font-family: var(--font-tamil), var(--font-body);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }
  .center-controls {
    flex-direction: row;
    padding-top: 0;
    justify-content: center;
  }
  .btn-convert { width: 52px; height: 52px; }
  .about-grid { grid-template-columns: 1fr; }
  .header-nav .nav-link:not(.nav-link--external):not(.btn-theme-toggle):not(.btn-lang-toggle) { display: none; }
  .stats-bar {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .stat-item { padding: 0 16px; }
}

@media (max-width: 600px) {
  .hero { padding: 48px 16px 32px; }
  .hero-title { font-size: 36px; }
  .hero-desc { font-size: 16px; }
  .converter-section { padding: 0 16px 60px; }
  .info-section { padding: 60px 16px; }
  .panel-actions .btn-icon span { display: none; }
  .panel-actions .btn-icon { padding: 7px 10px; }
  .options-row { padding: 14px 16px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--col-surface); }
::-webkit-scrollbar-thumb { background: var(--col-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--col-text-dim); }
