/* ═══════════════════════════════════════════════════
   TRADUCTOR — Translator-specific styles
   ═══════════════════════════════════════════════════ */

.tr-main-card {
  padding: 20px;
}

/* Direction toggle bar */
.tr-direction-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.tr-dir-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tr-dir-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.tr-dir-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Input section */
.tr-input-section {
  margin-bottom: 16px;
}

.tr-input-section label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tr-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s ease;
}

.tr-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Action buttons row */
.tr-input-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.tr-action-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tr-action-btn:hover {
  border-color: var(--primary);
  background: var(--bg);
}

.tr-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tr-action-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tr-action-btn.primary:hover {
  background: var(--primary-dark);
}

/* Microphone recording state */
.tr-action-btn.recording {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  animation: pulse-recording 1.2s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.tr-mic-status {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  min-height: 1.2em;
}

.tr-mic-status.recording {
  color: var(--red);
  font-weight: 600;
}

/* Output sections */
.tr-output-section {
  margin-bottom: 16px;
}

.tr-output-section label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tr-label-hint {
  font-weight: 400;
  text-transform: none;
  font-size: 0.78rem;
  opacity: 0.7;
}

/* Translation output box */
.tr-output-box {
  min-height: 60px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.tr-placeholder {
  color: var(--muted);
  font-style: italic;
}

/* Pronunciation box */
.tr-pron-box {
  min-height: 40px;
  padding: 12px 14px;
  background: #fffef5;
  border: 1px solid #e8d44d;
  border-radius: 10px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #5a4e00;
  font-style: italic;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tr-pron-box .tr-placeholder {
  color: #a09550;
}

.tr-play-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #c9a800;
  background: #fffef5;
  color: #5a4e00;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tr-play-btn:hover {
  background: #fdf5c0;
}

.tr-play-btn.hidden {
  display: none;
}

/* Examples section */
.tr-examples-box {
  min-height: 40px;
  padding: 14px 16px;
  background: #f7f0ff;
  border: 1px solid #d4c0f0;
  border-radius: 10px;
  line-height: 1.6;
}

.tr-meanings-box {
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #f7f0ff;
  border: 1px solid #d4c0f0;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.tr-meanings-label {
  font-weight: 700;
  color: #5a3e85;
  display: block;
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.tr-meanings-text {
  color: #3d2560;
}

/* Synonym cards grid */
.tr-synonyms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tr-synonym-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #dcc8f5;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tr-synonym-card:hover {
  border-color: #b890e8;
  box-shadow: 0 1px 4px rgba(106, 27, 154, 0.08);
}

.tr-synonym-word {
  font-weight: 700;
  font-size: 1rem;
  color: #3d2560;
}

.tr-synonym-context {
  font-size: 0.82rem;
  color: #6a5d7a;
  line-height: 1.4;
}

/* Example item with Spanish-as-primary style */
.tr-example-es-strong {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.tr-example-item {
  padding: 12px 0;
  border-bottom: 1px solid #e8dcf5;
}

.tr-example-item:last-child {
  border-bottom: none;
}

.tr-example-en {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.tr-example-pron {
  font-size: 0.85rem;
  color: #5a4e00;
  font-style: italic;
  background: #fffef5;
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.tr-example-es {
  font-size: 0.9rem;
  color: var(--muted);
}

.tr-example-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.tr-example-actions .icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.tr-example-actions .icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg);
}

/* Evaluation box */
.tr-eval-box {
  min-height: 50px;
  padding: 14px 16px;
  background: #f0f7ff;
  border: 1px solid #b0d4f1;
  border-radius: 10px;
  line-height: 1.6;
}

.tr-eval-result {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tr-eval-score {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "JetBrains Mono", monospace;
}

.tr-eval-grade {
  font-size: 0.95rem;
  font-weight: 600;
}

.tr-eval-detail {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
}

.tr-eval-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--border);
  margin-top: 8px;
  overflow: hidden;
}

.tr-eval-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

/* Error box */
.tr-error {
  background: #fff0f0;
  color: #a02020;
  border: 1px solid #e5b0b0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 10px;
}

.tr-error.hidden {
  display: none;
}

/* Spinner for loading */
.tr-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 4px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 480px) {
  .tr-direction-bar {
    flex-direction: column;
  }
  .tr-dir-btn {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  .tr-pron-box {
    flex-direction: column;
  }
  .tr-eval-result {
    flex-direction: column;
    align-items: flex-start;
  }
}