/* ==========================================================================
   DanskVocab - UI Components & Grammar Tables
   ========================================================================== */

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-text,
.select-input,
.textarea-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--text-main);
  background: var(--bg-surface-subtle);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.input-text:focus,
.select-input:focus,
.textarea-input:focus {
  background: var(--bg-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.input-icon-left {
  padding-left: 2.75rem;
}

.input-icon-right {
  padding-right: 2.75rem;
}

.icon-left {
  position: absolute;
  left: 0.9rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.icon-right-btn {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--text-subtle);
  padding: 0.4rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-right-btn:hover {
  color: var(--text-main);
}

/* Danish Character Keyboard Helper */
.danish-char-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.danish-char-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.2rem;
}

.danish-char-btn {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.danish-char-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(200, 16, 46, 0.25);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 8px rgba(200, 16, 46, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--border-light);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.4rem 0.75rem;
}

.btn-ghost:hover {
  color: var(--text-main);
  background: var(--bg-surface-subtle);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.6rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.badge-noun {
  background: var(--pos-noun-bg);
  color: var(--pos-noun);
  border: 1px solid var(--pos-noun-border);
}

.badge-verb {
  background: var(--pos-verb-bg);
  color: var(--pos-verb);
  border: 1px solid var(--pos-verb-border);
}

.badge-adj {
  background: var(--pos-adj-bg);
  color: var(--pos-adj);
  border: 1px solid var(--pos-adj-border);
}

.badge-other {
  background: var(--pos-other-bg);
  color: var(--pos-other);
  border: 1px solid var(--pos-other-border);
}

.badge-gender {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
}

/* Audio Pronunciation Button */
.btn-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  color: var(--color-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-audio:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: scale(1.08);
}

.btn-audio.playing {
  background: var(--color-primary);
  color: white;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

/* Grammar Table / Inflection Display */
.grammar-container {
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  margin-top: 1rem;
}

.grammar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.grammar-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.grammar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.grammar-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color var(--transition-fast);
}

.grammar-cell:hover {
  border-color: var(--border-medium);
}

.grammar-cell-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-subtle);
}

.grammar-cell-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-display);
  word-break: break-word;
}

.grammar-cell-val input {
  width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.15rem 0.35rem;
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-main);
}

.grammar-cell-val input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-surface);
}

.grammar-input-row,
.grammar-cell-val-with-audio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.grammar-input-row input {
  flex: 1;
  min-width: 0;
}

.btn-grammar-audio {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  font-size: 0.75rem;
  padding: 0;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-grammar-audio:hover {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
  transform: scale(1.08);
}

.btn-grammar-audio.playing {
  background: var(--color-primary);
  border-color: var(--color-primary);
  animation: pulseAudio 0.8s infinite alternate;
}

@keyframes pulseAudio {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

/* Vocabulary Inflection Chips in Library */
.vocab-infl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.vocab-infl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-main);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vocab-infl-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.vocab-infl-chip .infl-speaker-icon {
  font-size: 0.65rem;
  opacity: 0.6;
}

.vocab-infl-chip:hover .infl-speaker-icon {
  opacity: 1;
}

/* Tag Chips & Badges */
.tag-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  transition: all var(--transition-fast);
  user-select: none;
}

.tag-chip-selectable {
  cursor: pointer;
}

.tag-chip-selectable:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.tag-chip-selectable.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.tag-chip-removable {
  padding-right: 0.35rem;
}

.tag-chip-removable .btn-tag-remove {
  background: none;
  border: none;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.15rem;
  border-radius: 50%;
  transition: color var(--transition-fast);
}

.tag-chip-removable .btn-tag-remove:hover {
  color: var(--color-danger);
}

.tag-chip-count {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.1);
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-pill);
  margin-left: 0.2rem;
}

/* Batch Words Table */
.batch-words-list-container {
  background: var(--bg-surface);
}

.batch-word-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  gap: 0.75rem;
  transition: background var(--transition-fast);
}

.batch-word-item:last-child {
  border-bottom: none;
}

.batch-word-item:hover {
  background: var(--bg-surface-subtle);
}

.batch-word-item.selected {
  background: var(--color-primary-subtle);
}

.batch-word-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.batch-word-dan {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.9rem;
}

.batch-word-eng {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-word-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

/* Inline In-Card Tag Popover */
.in-card-tags-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-light);
}

.btn-card-add-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-add-tag:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.in-card-tag-popover {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  width: 90%;
  max-width: 340px;
  animation: fadeIn 150ms ease-out forwards;
}

.in-card-tag-popover.visible {
  display: block;
}

/* Result Preview Box */
.result-preview {
  display: none;
  animation: fadeIn 300ms ease-out forwards;
}

.result-preview.active {
  display: block;
}

.word-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.word-main-dan {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.word-trans-eng {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.word-ipa {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-top: 0.2rem;
}

.example-box {
  background: var(--bg-surface-subtle);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.example-dan {
  font-weight: 600;
  color: var(--text-main);
}

.example-eng {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* Vocabulary List & Library */
.library-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.search-box {
  flex: 1;
  min-width: 240px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: var(--bg-surface);
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.vocab-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.vocab-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.vocab-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.vocab-item-dan {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vocab-item-eng {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.vocab-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.vocab-item-actions {
  display: flex;
  gap: 0.25rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slideToast 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideToast {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

/* Home Quick Search Dropdown */
.home-search-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.home-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.home-search-dropdown.visible {
  display: block;
}

.home-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.home-search-item:last-child {
  border-bottom: none;
}

.home-search-item:hover {
  background: var(--bg-surface-subtle);
}

.home-search-item-dan {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.home-search-item-eng {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.home-search-empty-prompt {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.home-search-analyze-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.875rem;
}

.home-search-analyze-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Duplicate Word Warning & Indicators
   ========================================================================== */
.input-duplicate-hint {
  margin-top: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  animation: fadeIn 200ms ease;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #b45309;
}

[data-theme="dark"] .input-duplicate-hint {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.3);
  color: #fde047;
}

.duplicate-alert-banner {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-left: 4px solid #eab308;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: fadeIn 200ms ease;
}

.duplicate-alert-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.duplicate-alert-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #b45309;
}

[data-theme="dark"] .duplicate-alert-title {
  color: #fde047;
}

.duplicate-alert-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Firebase Sync Status Indicators
   ========================================================================== */
.firebase-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.firebase-status-pill:hover {
  border-color: var(--border-strong);
}

.firebase-status-pill .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-subtle);
}

.firebase-status-pill.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

[data-theme="dark"] .firebase-status-pill.connected {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.firebase-status-pill.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.firebase-status-pill.syncing {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
}

.firebase-status-pill.syncing .status-dot {
  background: #3b82f6;
  animation: pulse 1s infinite;
}

/* ==========================================================================
   Contextual Translator Studio Components
   ========================================================================== */
.translator-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

.translator-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.translator-lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.5rem;
  box-shadow: var(--shadow-sm);
  gap: 0.5rem;
}

.lang-pill-btn {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  cursor: default;
}

.lang-pill-btn.active {
  background: var(--color-primary);
  color: white;
}

.btn-swap-lang {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.btn-swap-lang:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  transform: rotate(180deg);
}

.tone-selector-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tone-chip {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tone-chip:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.tone-chip.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Translator Editors Grid */
.translator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .translator-grid {
    grid-template-columns: 1fr;
  }
}

.translator-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 280px;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

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

.translator-card-head {
  padding: 0.75rem 1rem;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.translator-textarea {
  flex: 1;
  width: 100%;
  padding: 1.25rem;
  border: none;
  background: transparent;
  font-family: var(--font-main);
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-main);
  resize: none;
  outline: none;
  min-height: 180px;
}

.translator-output-box {
  flex: 1;
  padding: 1.25rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-main);
  min-height: 180px;
  white-space: pre-wrap;
}

.translator-card-foot {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.char-counter {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.translator-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Linguistic & Context Notes Card */
.linguistic-notes-container {
  display: none;
  animation: fadeIn 300ms ease;
}

.linguistic-notes-container.active {
  display: block;
}

.notes-main-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

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

.notes-title {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.note-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.note-box-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.note-box-title.tone { color: var(--color-accent); }
.note-box-title.grammar { color: var(--pos-verb); }
.note-box-title.idiom { color: var(--pos-adj); }
.note-box-title.nuance { color: var(--pos-other); }

.note-box-content {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-main);
}

.note-box-content ul {
  padding-left: 1.2rem;
  margin-top: 0.4rem;
}

.note-box-content li {
  margin-bottom: 0.35rem;
}

/* Extracted Key Vocabulary Section */
.extracted-vocab-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-medium);
}

.extracted-vocab-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.extracted-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.extracted-vocab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.extracted-vocab-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.extracted-vocab-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.extracted-vocab-dan {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.extracted-vocab-eng {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.extracted-vocab-infl {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.btn-add-extracted-card {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
}

/* Settings Workspace */
.settings-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem 1.25rem;
}

@media (max-width: 768px) {
  .settings-container {
    padding: 1rem 0.75rem 2rem 0.75rem;
  }
}

/* ==========================================================================
   Google Authentication Gate & User Profile
   ========================================================================== */

/* Auth Overlay Screen */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1.5rem;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: authFadeUp 0.35s ease-out;
}

@keyframes authFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-brand {
  margin-bottom: 2rem;
}

.auth-brand-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.12));
}

.auth-brand-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.auth-brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.auth-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.auth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Official Google Sign-In Button */
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-fast);
}

.btn-google-signin:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.btn-google-signin:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.google-icon {
  flex-shrink: 0;
}

.auth-restricted-notice {
  margin-top: 1.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  color: var(--text-subtle);
}

.auth-restricted-notice strong {
  color: var(--color-primary);
}

/* Access Denied State */
.auth-denied-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.auth-denied-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

/* Sidebar User Profile */
.sidebar-user-section {
  padding: 0.75rem 0.5rem 0.5rem 0.5rem;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}

.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
}

.user-avatar-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-display-name {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-text {
  font-size: 0.725rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
