/* ==========================================================
   All Keyboards – Translator page
   (header, footer and on-screen keyboard come from style.css)
   ========================================================== */
.tr-page {
  --tr-ink: #10262c;
  --tr-muted: #5b6b70;
  --tr-line: #e2e9eb;
  --tr-soft: #e3f1f4;       /* light teal – active pills, icon squares */
  --tr-panel: #f5f8f9;      /* right (output) panel */
  --tr-radius: 16px;
  --tr-shadow: 0 1px 2px rgba(16, 38, 44, .04), 0 10px 30px rgba(16, 38, 44, .05);

  font-family: "Plus Jakarta Sans", var(--font-hi), system-ui, sans-serif;
  color: var(--tr-ink);
  background: #f3f7f8;
  padding: 56px 0 72px;
}

/* Lucide icons: thin outline */
.tr-page svg.lucide { width: 20px; height: 20px; stroke-width: 1.6; flex-shrink: 0; }

/* ---------- Hero ---------- */
.tr-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}
.tr-eyebrow {
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal-dark);
}
.tr-title {
  margin: 0 0 16px;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.08;
  color: var(--tr-ink);
}
.tr-lead {
  max-width: 620px;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--tr-muted);
}

.tr-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 12px 20px;
  border: 1px solid #d5dfe2;
  border-radius: 10px;
  background: var(--white);
  color: var(--tr-ink);
  font: 600 .95rem/1 inherit;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.tr-btn-outline svg.lucide { color: var(--teal-dark); width: 18px; height: 18px; }
.tr-btn-outline:hover { border-color: var(--teal); }
.tr-btn-outline[aria-expanded="true"] { background: var(--tr-soft); border-color: var(--teal); }

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

/* two halves that line up with the panels below: Hindi | target languages */
.tr-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--tr-line);
}
.tr-bar .lang-pills { padding: 14px 20px; }
.tr-bar .lang-pills[data-side="target"] { border-left: 1px solid var(--tr-line); }

.lang-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.lang-pills::-webkit-scrollbar { display: none; }

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #33454a;
  font-family: inherit;
  font-size: .98rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.lang-pill:hover { background: #f0f5f6; }
.lang-pill.is-active { background: var(--tr-soft); color: var(--teal-dark); font-weight: 600; }
.lang-pill:focus-visible,
.tr-icon-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.lang-more-toggle svg.lucide { width: 16px; height: 16px; }
.lang-more-toggle::after { display: none; }   /* hide Bootstrap's caret */

.lang-menu {
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  box-shadow: var(--tr-shadow);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}
.lang-menu .dropdown-item { border-radius: 8px; padding: 8px 12px; font-size: .95rem; }
.lang-menu .dropdown-item:active,
.lang-menu .dropdown-item.is-active { background: var(--tr-soft); color: var(--teal-dark); font-weight: 600; }


/* ---------- Panels ---------- */
.tr-panels { display: grid; grid-template-columns: 1fr 1fr; }

.tr-panel {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  padding: 28px 32px 24px;
}
.tr-panel--target { background: var(--tr-panel); border-left: 1px solid var(--tr-line); position: relative; }

.tr-panel-label { margin-bottom: 14px; font-size: .85rem; font-weight: 600; color: #33454a; }

.tr-textarea,
.tr-output {
  flex: 1;
  font-family: "Plus Jakarta Sans", var(--font-hi), system-ui, sans-serif;
  font-size: 1.6rem;
  line-height: 1.5;
  color: var(--tr-ink);
}
.tr-textarea {
  width: 100%;
  min-height: 200px;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
}
.tr-textarea::placeholder { color: #a9b3b6; }

.tr-output {
  min-height: 200px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition: opacity .15s;
}
.tr-output.is-empty { color: #a9b3b6; }
.tr-output.is-loading { opacity: .45; }
.tr-output.is-error { color: #b42318; font-size: 1rem; }

.tr-status {
  position: absolute;
  top: 26px;
  right: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--teal-dark);
}
.tr-status[hidden] { display: none; }
.tr-status svg.lucide { width: 16px; height: 16px; }
.tr-spin { animation: tr-spin .9s linear infinite; }
@keyframes tr-spin { to { transform: rotate(360deg); } }

.tr-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.tr-icons { display: flex; gap: 6px; }

.tr-icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #33454a;
  transition: background .15s, color .15s;
}
.tr-icon-btn:hover { background: #e9f0f2; }
.tr-icon-btn[aria-pressed="true"] { color: var(--teal-dark); background: var(--tr-soft); }

/* mic: idle vs recording icon */
.tr-icon-btn .icon-active,
.tr-icon-btn svg.icon-active { display: none; }
#micBtn.is-recording svg.icon-idle { display: none; }
#micBtn.is-recording svg.icon-active { display: block; fill: currentColor; width: 14px; height: 14px; }
#micBtn.is-recording {
  background: #e53935;
  color: var(--white);
  animation: tr-pulse 1.3s ease-out infinite;
}
@keyframes tr-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 57, 53, .5); }
  100% { box-shadow: 0 0 0 14px rgba(229, 57, 53, 0); }
}
#micBtn.is-unsupported { opacity: .4; cursor: not-allowed; }

.tr-counter { font-size: .85rem; color: var(--tr-muted); font-variant-numeric: tabular-nums; }
.tr-counter.is-full { color: #b42318; font-weight: 600; }

.tr-btn-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--teal-dark);
  color: var(--white);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  transition: background .15s;
}
.tr-btn-copy:hover { background: #0f4f5d; }
.tr-btn-copy svg.lucide { width: 18px; height: 18px; }

/* "Copied!" bubble shown above a button */
.tr-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--tr-ink);
  color: var(--white);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.tr-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--tr-ink);
}
.tr-tip.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- On-screen keyboard ---------- */
.tr-keyboard { margin-top: 24px; }
.tr-keyboard[hidden] { display: none; }
.tr-keyboard .vkeyboard { margin: 0 auto; font-family: var(--font); }
.tr-kb-note {
  max-width: 900px;
  margin: 0 auto 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--tr-soft);
  color: var(--teal-dark);
  font-size: .9rem;
}

/* ---------- Features ---------- */
.tr-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}
.tr-feature {
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--tr-line);
  border-radius: var(--tr-radius);
  box-shadow: 0 1px 2px rgba(16, 38, 44, .03);
}
.tr-feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: 10px;
  background: var(--tr-soft);
  color: var(--teal-dark);
}
.tr-feature h2 { margin: 0 0 12px; font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }
.tr-feature p { margin: 0; font-size: .95rem; line-height: 1.6; color: var(--tr-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
  .tr-bar .lang-pills { padding: 14px; }
  .lang-pill { padding: 9px 11px; font-size: .93rem; }
}

@media (max-width: 991.98px) {
  .tr-bar { grid-template-columns: 1fr; }
  .tr-bar .lang-pills { padding: 10px 12px; }
  .tr-bar .lang-pills[data-side="target"] { border-left: 0; border-top: 1px solid var(--tr-line); }
  .tr-features { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .tr-page { padding: 32px 0 48px; }
  .tr-hero { flex-direction: column; align-items: flex-start; margin-bottom: 28px; }
  .tr-lead { font-size: 1rem; }
  .tr-panels { grid-template-columns: 1fr; }
  .tr-panel { min-height: 260px; padding: 20px; }
  .tr-panel--target { border-left: 0; border-top: 1px solid var(--tr-line); }
  .tr-textarea, .tr-output { font-size: 1.3rem; min-height: 140px; }
  .tr-status { top: 18px; right: 20px; }
  .lang-pill { padding: 8px 12px; font-size: .92rem; }
}
