/*
 * styles.css — Custom styles layered on Tailwind CSS
 *
 * Tailwind utility classes handle most of the styling directly in HTML.
 * These custom classes handle:
 *   - Component-level patterns too verbose for inline Tailwind
 *   - Animations (mic pulse, transcript entry slide-in)
 *   - Toast notifications
 *   - Transcript card / translation layout
 *   - Typing panel large-text output
 *   - Dark mode overrides
 */

/* ===========================================================================
   LANGUAGE OPTION (onboarding checkboxes)
   =========================================================================== */

.lang-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  transition: border-color 0.15s, background-color 0.15s;
}

.lang-option:has(input:checked) {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.dark .lang-option:has(input:checked) {
  border-color: #60a5fa;
  background-color: rgba(59, 130, 246, 0.15);
}

.lang-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lang-option-body {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  width: 100%;
  border-radius: 0.625rem;
}

.lang-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.lang-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.dark .lang-name {
  color: #d1d5db;
}

/* ===========================================================================
   BUTTONS
   =========================================================================== */

.btn-primary {
  padding: 0.5rem 1rem;
  border-radius: 0.625rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #ffffff;
  background-color: #2563eb;
  transition: background-color 0.15s;
  cursor: pointer;
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border-radius: 0.625rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: #374151;
  background-color: #f3f4f6;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.dark .btn-secondary {
  color: #d1d5db;
  background-color: #374151;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.dark .btn-secondary:hover {
  background-color: #4b5563;
}

.btn-danger {
  padding: 0.5rem 1rem;
  border-radius: 0.625rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: #ffffff;
  background-color: #dc2626;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
  font-size: 1rem;
}

.btn-icon:hover {
  background-color: #f3f4f6;
}

.dark .btn-icon:hover {
  background-color: #374151;
}

/* ===========================================================================
   MIC BUTTON
   =========================================================================== */

.mic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.mic-btn:hover {
  transform: scale(1.1);
}

.mic-btn.state-listening {
  background-color: #dcfce7;
  border-color: #22c55e;
}

.dark .mic-btn.state-listening {
  background-color: rgba(34, 197, 94, 0.2);
  border-color: #4ade80;
}

.mic-btn.state-muted {
  background-color: #fef3c7;
  border-color: #f59e0b;
}

.dark .mic-btn.state-muted {
  background-color: rgba(245, 158, 11, 0.2);
  border-color: #fbbf24;
}

.mic-btn.state-stopped {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.dark .mic-btn.state-stopped {
  background-color: #374151;
  border-color: #6b7280;
}

/* ===========================================================================
   LANG TAG (inline language label in text)
   =========================================================================== */

.lang-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  background-color: #dbeafe;
  color: #1e40af;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.dark .lang-tag {
  background-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

/* ===========================================================================
   TRANSCRIPT CARDS (right panel history)
   =========================================================================== */

.transcript-card {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.875rem;
  padding: 0.875rem 1rem;
  animation: slide-in 0.2s ease-out;
  transition: box-shadow 0.15s;
}

.dark .transcript-card {
  background-color: #1f2937;
  border-color: #374151;
}

.transcript-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark .transcript-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.transcript-card.hidden {
  display: none;
}

.transcript-entry-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.entry-time {
  font-size: 0.7rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.entry-lang-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background-color: #ede9fe;
  color: #5b21b6;
}

.dark .entry-lang-badge {
  background-color: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
}

.entry-text {
  font-size: 0.9rem;
  color: #111827;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.dark .entry-text {
  color: #f9fafb;
}

.entry-translation {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid #a5b4fc;
  margin-bottom: 0.5rem;
}

.translation-arrow {
  color: #6366f1;
  margin-right: 0.25rem;
}

.translation-lang-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background-color: #e0e7ff;
  color: #3730a3;
  margin-right: 0.35rem;
}

.dark .translation-lang-badge {
  background-color: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
}

.translation-text {
  font-size: 0.875rem;
  color: #374151;
}

.dark .translation-text {
  color: #d1d5db;
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.translate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.translate-lang-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background-color: #f9fafb;
  color: #374151;
  cursor: pointer;
}

.dark .translate-lang-select {
  border-color: #4b5563;
  background-color: #374151;
  color: #d1d5db;
}

.btn-translate {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 0.375rem;
  border: 1px solid #bfdbfe;
  background-color: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  transition: background-color 0.15s;
}

.dark .btn-translate {
  border-color: rgba(59, 130, 246, 0.4);
  background-color: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.btn-translate:hover:not(:disabled) {
  background-color: #dbeafe;
}

.btn-translate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================================================================
   TYPING PANEL OUTPUT (large text for accessibility)
   =========================================================================== */

.typing-output {
  min-height: 4rem;
  padding: 1rem;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  color: #1e3a8a;
  background-color: #ffffff;
  border-radius: 0.75rem;
  border: 2px solid #a5b4fc;
  word-break: break-word;
}

.dark .typing-output {
  color: #c7d2fe;
  background-color: #1f2937;
  border-color: #6366f1;
}

/* ===========================================================================
   SETTINGS FORM ELEMENTS
   =========================================================================== */

.settings-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.dark .settings-label {
  color: #9ca3af;
}

.settings-select,
.settings-input {
  width: 100%;
  padding: 0.4rem 0.625rem;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #111827;
  outline: none;
  transition: border-color 0.15s;
}

.dark .settings-select,
.dark .settings-input {
  border-color: #4b5563;
  background-color: #374151;
  color: #f3f4f6;
}

.settings-select:focus,
.settings-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ===========================================================================
   DROPDOWN MENU
   =========================================================================== */

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.1s;
}

.dark .dropdown-item {
  color: #d1d5db;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
}

.dark .dropdown-item:hover {
  background-color: #4b5563;
}

/* ===========================================================================
   TOAST NOTIFICATION
   =========================================================================== */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 90vw;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-info    { background: #1e40af; color: #fff; }
.toast-success { background: #15803d; color: #fff; }
.toast-warning { background: #b45309; color: #fff; }
.toast-error   { background: #b91c1c; color: #fff; }

/* ===========================================================================
   ANIMATIONS
   =========================================================================== */

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================================================================
   SCROLLBAR STYLING (Chromium)
   =========================================================================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }
