/* Tradutor Eternal (tradutor.php) - 06/11/2026. Usa as variaveis de cor do style.css do site. */

.tr-shell .section-head h1 {
  margin: 0;
  font-family: Cinzel, serif;
  color: #fff5cf;
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  line-height: 1.15;
}

.tr-shell textarea,
.tr-shell .zh,
.tr-shell [lang^="zh"] {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft JhengHei", sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Seletor PT / 中文 da interface */
.tr-lang-switch {
  display: inline-flex;
  gap: 4px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 10, 15, 0.58);
}

.tr-lang-switch button {
  border: 0;
  border-radius: 999px;
  padding: 6px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.tr-lang-switch button[aria-pressed="true"] {
  color: #160b03;
  background: linear-gradient(180deg, #f9e4ab, #d49841 55%, #8a4a10);
}

/* Painel principal */
.tr-panel { padding: 18px; }

.tr-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tr-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tr-mode::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.tr-mode[data-state="ai"] { color: var(--green); border-color: rgba(95, 242, 154, 0.38); }
.tr-mode[data-state="ai"]::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.tr-mode[data-state="basic"] { color: var(--gold); }
.tr-mode[data-state="basic"]::before { background: var(--gold); }

.tr-variant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tr-select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.tr-select:focus,
.tr-shell button:focus-visible,
.tr-shell textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.tr-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.tr-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  transition: border-color 0.16s ease;
}

.tr-box:focus-within { border-color: var(--line-strong); }

.tr-box-head,
.tr-box-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
}

.tr-box-head { border-bottom: 1px solid var(--line); }
.tr-box-foot { justify-content: flex-end; border-top: 1px solid var(--line); }

.tr-box textarea {
  flex: 1;
  width: 100%;
  min-height: 240px;
  resize: vertical;
  padding: 14px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 1.06rem;
  line-height: 1.65;
}

.tr-box textarea::placeholder { color: var(--muted); opacity: 0.85; }
.tr-box-out textarea { background: rgba(212, 152, 65, 0.05); }
.tr-loading .tr-box-out textarea { opacity: 0.45; }

.tr-target { color: var(--gold); font-weight: 700; font-size: 0.92rem; }
.tr-count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-count.is-over { color: var(--danger); font-weight: 800; }
.tr-engine { margin-right: auto; color: var(--muted); font-size: 0.78rem; }

.tr-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tr-go { min-width: 160px; }
.tr-kbd { color: var(--muted); font-size: 0.75rem; }

.tr-spin {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(22, 11, 3, 0.3);
  border-top-color: #160b03;
  animation: trSpin 0.8s linear infinite;
}

.is-busy .tr-spin { display: inline-block; }
@keyframes trSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tr-spin { animation-duration: 2.4s; } }

.tr-mini {
  appearance: none;
  border: 1px solid rgba(235, 194, 91, 0.28);
  border-radius: 8px;
  padding: 5px 11px;
  background: rgba(7, 10, 15, 0.58);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.tr-mini:hover:not(:disabled) { color: var(--gold); border-color: rgba(235, 194, 91, 0.56); }
.tr-mini:disabled { opacity: 0.5; cursor: not-allowed; }
.tr-mini.is-copied { color: var(--green); border-color: rgba(95, 242, 154, 0.5); }

/* Status */
.tr-status {
  min-height: 44px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.tr-status.is-empty { visibility: hidden; }
.tr-status.is-info { border-left-color: var(--cyan); }
.tr-status.is-ok { border-left-color: var(--green); color: #d9ffe9; }
.tr-status.is-warn { border-left-color: var(--gold); color: #fff1c4; }
.tr-status.is-error { border-left-color: var(--danger); color: #ffd6db; }

.tr-note { margin: 12px 0 0; color: var(--muted); font-size: 0.84rem; }

/* Frases prontas e glossario */
.tr-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.tr-section { padding: 18px; }

.tr-section h2 {
  margin: 0;
  font-family: Cinzel, serif;
  color: #fff5cf;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
}

.tr-section-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }

.tr-cat h3,
.tr-gloss h3 {
  margin: 18px 0 8px;
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tr-phrase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(212, 152, 65, 0.16);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
}

.tr-phrase + .tr-phrase { margin-top: 8px; }
.tr-phrase .pt { color: var(--text); }
.tr-phrase .zh { color: var(--gold); font-size: 1.04rem; }

.tr-phrase-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tr-gloss-wrap { max-height: 520px; overflow: auto; }
.tr-gloss table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tr-gloss th,
.tr-gloss td { padding: 7px 8px; border-bottom: 1px solid rgba(212, 152, 65, 0.14); text-align: left; vertical-align: top; }
.tr-gloss th {
  background: rgba(18, 12, 7, 0.98);
  color: var(--cyan);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tr-gloss-wrap th { position: sticky; top: 0; }
.tr-abbr td strong { color: var(--text); white-space: nowrap; }
.tr-gloss td.zh { color: var(--gold); }

/* Historico */
.tr-hist { margin-top: 22px; }

.tr-hist > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.tr-hist > summary::-webkit-details-marker { display: none; }
.tr-hist > summary::before { content: "▸"; color: var(--cyan); transition: transform 0.15s; }
.tr-hist[open] > summary::before { transform: rotate(90deg); }

.tr-badge {
  margin-left: auto;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
}

.tr-hist-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.tr-hist-top { display: flex; justify-content: flex-end; margin: 12px 0; }
.tr-hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr-hist-item { padding: 10px 12px; border: 1px solid rgba(212, 152, 65, 0.16); border-radius: 10px; background: rgba(0, 0, 0, 0.24); }
.tr-hist-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 0.78rem; }
.tr-hist-meta strong { color: var(--gold); }
.tr-hist-src,
.tr-hist-out {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tr-hist-src { color: var(--muted); }
.tr-hist-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tr-hist-empty { color: var(--muted); }

/* Como usar */
.tr-help { margin-top: 22px; }
.tr-help ol { margin: 12px 0 0; padding-left: 20px; color: var(--text); }
.tr-help li + li { margin-top: 6px; }

/* Celular e tablet */
@media (max-width: 900px) {
  .tr-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tr-mid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .tr-go { width: 100%; min-width: 0; }
  .tr-kbd { display: none; }
  .tr-box textarea { min-height: 150px; }
  .tr-cols { grid-template-columns: minmax(0, 1fr); }
  .tr-gloss-wrap { max-height: 420px; }
}

@media (max-width: 520px) {
  .tr-panel, .tr-section { padding: 14px; }
  .tr-phrase { grid-template-columns: minmax(0, 1fr); }
  .tr-phrase-actions { grid-column: auto; grid-row: auto; justify-content: flex-start; margin-top: 6px; }
}
