@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Nastaliq+Urdu:wght@400;700&family=Noto+Sans+Devanagari:wght@400;500;600&display=swap');

/* ══════════════════════════════════════
   LIGHT MODE — default
══════════════════════════════════════ */
.uht-root {
  --bg-card:        #f6f7ff;
  --bg-toolbar:     #f6f7ff;
  --bg-chips:       #f6f7ff;
  --bg-panel-l:     #ffffff;
  --bg-panel-r:     #ffffff;
  --bg-panelbar:    #f6f7ff;
  --bg-label:       #f6f7ff;

  --border:         #e2c9a0;
  --divider:        #eddfc0;

  --text-h:         #1a100a;
  --text-body:      #2a1a0e;
  --text-muted:     #7a5a3a;
  --text-dim:       #c8a878;

  --accent:         #c2410c;
  --accent-h:       #9a3409;
  --accent-light:   #fff7ed;
  --accent-dim:     #fed7aa;

  --chip-bg:        #fff3e0;
  --chip-border:    #f5d090;
  --chip-hover:     #ffe8b8;
  --chip-text:      #92400e;

  --urdu-text:      #1a100a;
  --hindi-text:     #1a100a;
  --ph-color:       #c8a878;
  --err-color:      #b91c1c;

  --badge-nastaliq-bg:   #fff3e0;
  --badge-nastaliq-txt:  #92400e;
  --badge-devanagari-bg: #fef9f0;
  --badge-devanagari-txt:#78350f;

  --swap-bg:        #fff7ed;
  --swap-border:    #f5d090;
  --swap-color:     #c2410c;

  --shadow: 0 2px 20px rgba(194,65,12,0.09), 0 0 0 1px #e2c9a0;
  --radius:    14px;
  --radius-sm: 8px;

  max-width: 860px;
  margin: 0 auto;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-body);
  box-sizing: border-box;
}

/* ══════════════════════════════════════
   DARK MODE
══════════════════════════════════════ */
.uht-root.uht-dark {
  --bg-card:        #1a120a;
  --bg-toolbar:     #140e06;
  --bg-chips:       #160e06;
  --bg-panel-l:     #1a120a;
  --bg-panel-r:     #140e08;
  --bg-panelbar:    #140e06;
  --bg-label:       #160e06;

  --border:         #3a2510;
  --divider:        #2a1c0a;

  --text-h:         #f5ddb8;
  --text-body:      #ddc898;
  --text-muted:     #8a6840;
  --text-dim:       #3a2810;

  --accent:         #f97316;
  --accent-h:       #fb923c;
  --accent-light:   #431407;
  --accent-dim:     #7c2d12;

  --chip-bg:        #2a1a08;
  --chip-border:    #3a2510;
  --chip-hover:     #341e0a;
  --chip-text:      #fdba74;

  --urdu-text:      #f5ddb8;
  --hindi-text:     #f5ddb8;
  --ph-color:       #3a2810;

  --badge-nastaliq-bg:   #2a1a08;
  --badge-nastaliq-txt:  #fdba74;
  --badge-devanagari-bg: #241608;
  --badge-devanagari-txt:#fcd34d;

  --swap-bg:        #2a1a08;
  --swap-border:    #3a2510;
  --swap-color:     #f97316;

  --shadow: 0 4px 32px rgba(0,0,0,0.7), 0 0 0 1px #3a2510;
}

/* ══════════════════════════════════════
   SEO HEADER
══════════════════════════════════════ */
.uht-h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.uht-tagline {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 20px;
  transition: color 0.3s;
}

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */
.uht-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background 0.3s, box-shadow 0.3s;
}

/* ── Toolbar ── */
.uht-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
  gap: 10px;
}

.uht-lang-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.uht-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s;
  white-space: nowrap;
}

.uht-tab.uht-tab-active { color: var(--accent); }

.uht-tab-text { letter-spacing: 0.01em; }

.uht-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.uht-dot-ur { background: var(--accent); }
.uht-dot-hi { background: #16a34a; }

/* Swap button (decorative) */
.uht-swap-wrap { flex-shrink: 0; }

.uht-swap-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--swap-bg);
  border: 1px solid var(--swap-border);
  color: var(--swap-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  opacity: 0.7;
  transition: background 0.2s;
}

/* Theme toggle */
.uht-theme-btn {
  background: var(--bg-panel-l);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
  padding: 0;
  flex-shrink: 0;
}
.uht-theme-btn:hover { background: var(--chip-hover); }

/* ── Chips ── */
.uht-chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 18px 12px;
  background: var(--bg-chips);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.uht-chips-label {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
  direction: rtl;
}

.uht-chip {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 13px;
  color: var(--chip-text);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 20px;
  padding: 4px 14px;
  cursor: pointer;
  transition: all 0.15s;
  direction: rtl;
  line-height: 1.9;
}
.uht-chip:hover {
  background: var(--chip-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* ══════════════════════════════════════
   PANELS
══════════════════════════════════════ */
.uht-panels {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  min-height: 260px;
}

.uht-divider { background: var(--divider); }

.uht-panel {
  display: flex;
  flex-direction: column;
}

.uht-panel-left  { background: var(--bg-panel-l); transition: background 0.3s; }
.uht-panel-right { background: var(--bg-panel-r); transition: background 0.3s; }

/* ── Panel label ── */
.uht-panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-label);
  border-bottom: 1px solid var(--divider);
  transition: background 0.3s, color 0.3s;
}

.uht-label-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Script badges */
.uht-script-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  padding: 2px 8px;
  letter-spacing: 0.02em;
  transition: background 0.3s, color 0.3s;
}

.uht-badge-nastaliq {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 12px;
  background: var(--badge-nastaliq-bg);
  color: var(--badge-nastaliq-txt);
  direction: rtl;
  letter-spacing: 0;
}

.uht-badge-devanagari {
  font-family: 'Noto Sans Devanagari', serif;
  font-size: 11px;
  background: var(--badge-devanagari-bg);
  color: var(--badge-devanagari-txt);
}

/* ── Textarea — Urdu Nastaliq RTL ── */
.uht-textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 16px 18px;
  box-sizing: border-box;
  display: block;
  transition: color 0.3s;
}

.uht-urdu {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 21px;
  line-height: 2.3;
  direction: rtl;
  text-align: right;
  color: var(--urdu-text);
  caret-color: var(--accent);
}

.uht-urdu::placeholder {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 16px;
  color: var(--text-dim);
}

/* ── Hindi output — Devanagari ── */
.uht-out-area {
  flex: 1;
  padding: 16px 18px;
  min-height: 200px;
}

.uht-out-text {
  font-family: 'Noto Sans Devanagari', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--hindi-text);
  line-height: 1.85;
  margin: 0;
  transition: color 0.3s;
}

.uht-ph {
  font-family: 'Noto Sans Devanagari', serif;
  font-size: 16px;
  color: var(--ph-color);
  line-height: 1.7;
  font-style: normal;
  margin: 0;
  transition: color 0.3s;
}

/* ── Loader ── */
.uht-loader { display: none; gap: 5px; align-items: center; margin-top: 14px; }
.uht-loader.uht-on { display: flex; }

.uht-ld {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.2;
  animation: uht-pulse 1.2s ease-in-out infinite;
}
.uht-ld:nth-child(2) { animation-delay: 0.2s; }
.uht-ld:nth-child(3) { animation-delay: 0.4s; }
@keyframes uht-pulse { 0%,100%{opacity:.15} 50%{opacity:.85} }

.uht-err {
  font-size: 13px;
  color: var(--err-color);
  line-height: 1.5;
  margin: 8px 0 0;
}

/* ── Panel bottom bar ── */
.uht-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px 10px;
  background: var(--bg-panelbar);
  border-top: 1px solid var(--divider);
  gap: 8px;
  transition: background 0.3s;
}

.uht-panel-bar-r { justify-content: flex-end; }

.uht-bar-btns { display: flex; gap: 8px; align-items: center; }

.uht-cc {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.uht-word-count {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.uht-btn {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  padding: 7px 16px;
  line-height: 1.4;
  transition: all 0.15s;
  white-space: nowrap;
}

.uht-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--divider);
}
.uht-ghost:hover { background: var(--chip-bg); color: var(--text-body); border-color: var(--border); }

.uht-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 14px;
  line-height: 1.8;
  direction: rtl;
}
.uht-primary:hover:not(:disabled) { background: var(--accent-h); border-color: var(--accent-h); }
.uht-primary:active:not(:disabled) { transform: scale(0.97); }
.uht-primary:disabled {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: var(--accent-dim);
  cursor: not-allowed;
}

.uht-copy-btn {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--chip-border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
  direction: ltr;
}
.uht-copy-btn:hover { background: var(--chip-bg); border-color: var(--accent); }
.uht-copy-btn.uht-ok { color: #15803d; border-color: #86efac; background: #f0fdf4; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 620px) {
  .uht-panels {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1px auto;
  }
  .uht-divider { height: 1px; }
  .uht-h1 { font-size: 18px; }
  .uht-lang-tabs { flex-wrap: wrap; gap: 6px; }
  .uht-swap-wrap { display: none; }
}
