/* ==========================================================================
   DEEPL PRO TRANSLATE - COMPONENTS & EDITOR STYLES
   ========================================================================== */

/* ================= TRANSLATOR CARD & DUAL PANES ================= */
.translator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
}

.translator-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

/* ================= LANGUAGE BAR ================= */
.lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  gap: 0.75rem;
}

.lang-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.lang-group::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.lang-pills-list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Language Pill Buttons */
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.lang-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.lang-pill.active {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--accent-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.detected-lang-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-teal);
  background: rgba(0, 212, 178, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-left: 4px;
}

.detected-lang-label:empty {
  display: none;
}

/* Language Dropdown Selector Button */
.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.lang-dropdown-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.lang-dropdown-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

/* Swap Button */
.swap-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.swap-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  transform: rotate(180deg);
  box-shadow: 0 2px 10px var(--accent-primary-glow);
}

.swap-btn svg {
  width: 17px;
  height: 17px;
}

/* Formality Switcher */
.formality-dropdown {
  position: relative;
  margin-left: auto;
}

.formality-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.formality-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.formality-btn svg {
  width: 14px;
  height: 14px;
}

.formality-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  min-width: 190px;
  z-index: 50;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: fadeIn 0.15s ease;
}

.formality-menu.show {
  display: flex;
}

.formality-item {
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.formality-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.formality-item.active {
  background: rgba(0, 102, 255, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

/* ================= PANES CONTAINER & EDITORS ================= */
.panes-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
  position: relative;
}

.pane {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 420px;
}

.source-pane {
  border-right: 1px solid var(--border-subtle);
}

.target-pane {
  background: var(--bg-input);
}

.textarea-wrapper {
  flex: 1;
  display: flex;
  position: relative;
  padding: 1rem 1.25rem 0.5rem 1.25rem;
}

/* Source Input Textarea */
.translate-textarea {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  resize: none;
}

.translate-textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Clear Button */
.clear-btn {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.clear-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.clear-btn svg {
  width: 14px;
  height: 14px;
}

.clear-btn.visible {
  display: flex;
}

/* Target Output Container */
.translate-output {
  width: 100%;
  height: 100%;
  min-height: 320px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  overflow-y: auto;
  word-break: break-word;
  user-select: text;
}

.translate-output .placeholder-text {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

/* Clickable word tokens in translation output */
.output-word {
  display: inline;
  padding: 1px 2px;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.output-word:hover {
  background: rgba(0, 102, 255, 0.2);
  color: var(--accent-primary);
}

.output-word.active-word {
  background: rgba(0, 212, 178, 0.25);
  color: var(--accent-teal);
  font-weight: 600;
}

/* Shimmer Loader */
.pane-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 10;
  color: var(--accent-teal);
  font-size: 0.9rem;
  font-weight: 600;
}

.pane-loader.active {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 212, 178, 0.2);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================= TOOLBARS ================= */
.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: transparent;
  gap: 0.5rem;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.tool-btn svg {
  width: 17px;
  height: 17px;
}

/* Active Voice Mic Recording State */
.tool-btn#btnVoiceInput.recording {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Star Active State */
.tool-btn#btnStarTranslation.active svg {
  fill: var(--accent-gold);
  stroke: var(--accent-gold);
}

/* Character count indicator */
.character-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.5rem;
}

/* Primary Manual Translate button */
.primary-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.15rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #004ecc 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
  transition: all var(--transition-fast);
}

.primary-action-btn:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover) 0%, var(--accent-primary) 100%);
  box-shadow: 0 4px 14px var(--accent-primary-glow);
  transform: translateY(-1px);
}

.primary-action-btn svg {
  width: 15px;
  height: 15px;
}

/* Engine Badge */
.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 6px var(--accent-teal);
}

/* ================= DICTIONARY & ALTERNATIVES SECTION ================= */
.dictionary-section {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  display: none; /* Shown dynamically when text is translated */
  flex-direction: column;
  gap: 1rem;
}

.dictionary-section.active {
  display: flex;
}

.dict-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.dict-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
}

.dict-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.dict-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dict-content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
}

/* Alternatives Grid */
.alternatives-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.alt-card:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 102, 255, 0.08);
  transform: translateX(4px);
}

.alt-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.alt-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* Dictionary Card */
.dictionary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dict-word-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dict-term {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-phonetic {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.dict-pos {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: rgba(0, 102, 255, 0.15);
  color: var(--accent-primary);
  text-transform: uppercase;
}

.dict-definition {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dict-synonyms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.synonym-tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--accent-teal);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.synonym-tag:hover {
  background: rgba(0, 212, 178, 0.2);
}

/* Responsive Panes */
@media (max-width: 900px) {
  .panes-container {
    grid-template-columns: 1fr;
  }
  .source-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .dict-content {
    grid-template-columns: 1fr;
  }
  .lang-bar {
    flex-wrap: wrap;
  }
}
