body {
  font-family: 'Tajawal', sans-serif;
  background-color: #f8f9fa;
  color: #333;
}

/* Language Toggle */
#langToggle {
  line-height: 1;
  padding: 6px 12px;
  font-weight: 500;
  border-radius: 20px;
}

#langToggle i {
  vertical-align: middle;
  position: relative;
  top: -1px;
  font-size: 0.95em;
}

#langToggle .lang-label {
  vertical-align: middle;
  position: relative;
  top: 0.5px;
}

/* Form styling */
textarea#wordInput {
  resize: none;
  transition: box-shadow 0.2s ease;
}

textarea#wordInput:focus {
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.2);
}

/* Buttons */
#convertButton {
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

#convertButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* RTL Mode */
body.arabic-mode {
  direction: rtl;
  text-align: right;
  font-family: 'Tajawal', 'Noto Sans Arabic', sans-serif;
}

body.arabic-mode textarea,
body.arabic-mode input,
body.arabic-mode select {
  text-align: right;
}

#results b,
#results strong,
#results span {
  vertical-align: middle;
}

/* ND method chips */
.nd-chip {
  cursor: pointer;
  user-select: none;
  border: 1px solid #dee2e6;
  background-color: #fff;
  color: #495057;
  padding: 6px 10px;
  border-radius: 9999px;
  font-size: 0.875rem;
  line-height: 1.1;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  /* Unified active color to match Substitution */
  --chip-bg-active: #cff4fc;
}

/* Disabled chip appearance (unclickable Sub in Classic) */
.nd-chip[aria-disabled="true"] {
  /* Keep it looking like a neutral chip */
  cursor: default; /* do not show not-allowed */
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #495057;
  opacity: 1;
}
/* Ensure checked state doesn't recolor a disabled chip */
.btn-check:checked + .nd-chip[aria-disabled="true"] {
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #495057;
}
.btn-check:checked + .nd-chip[aria-disabled="true"] .method-count {
  background: #f1f3f5;
  color: #495057;
}
/* Suppress hover elevation for disabled chip */
.nd-chip[aria-disabled="true"]:hover {
  border-color: #dee2e6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.word-result.classic-mode label.nd-chip { display: none !important; }
.word-result.classic-mode label.nd-chip.nd-chip-sub { display: inline-flex !important; }
.word-result.classic-mode label[for^="toggle-old20-"] { display: none !important; }
.word-result.classic-mode label[for^="toggle-cluster-"] { display: none !important; }
.word-result.classic-mode input.btn-check { display: none !important; }
.word-result.classic-mode input[id^="toggle-sub-"] { display: inline !important; }

/* Broad mode: hide analytics chips (OLD20 and C) */
.word-result.broad-mode label[for^="toggle-old20-"] { display: none !important; }
.word-result.broad-mode label[for^="toggle-cluster-"] { display: none !important; }
.word-result.broad-mode input[id^="toggle-old20-"] { display: none !important; }
.word-result.broad-mode input[id^="toggle-cluster-"] { display: none !important; }

.nd-chip:hover {
  border-color: #cfd4da;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.nd-chip .method-icon {
  font-size: 0.9em;
  opacity: 0.85;
}

.nd-chip .method-count {
  display: inline-block;
  background: #f1f3f5;
  color: #495057;
  padding: 2px 6px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
}

/* Active states via adjacent checked input */
.btn-check:checked + .nd-chip {
  background-color: var(--chip-bg-active, #cff4fc);
  color: #0b2a2f; /* Better contrast like Substitution */
  border-color: transparent;
}

.btn-check:checked + .nd-chip .method-count {
  background: rgba(11,42,47,0.08);
  color: #0b2a2f;
}

/* Per-method accent colors unified to Substitution color */
.nd-chip-sub { --chip-bg-active: #cff4fc; }
.nd-chip-add { --chip-bg-active: #cff4fc; }
.nd-chip-edit { --chip-bg-active: #cff4fc; }
.nd-chip-del { --chip-bg-active: #cff4fc; }

/* OND info popover header: revert to light gray (default look) */
.ond-popover .popover-header {
  background-color: #f8f9fa; /* light gray */
  color: #212529;            /* default text */
  border-bottom: 1px solid #dee2e6; /* subtle gray border */
}

.ond-popover .popover-header .popover-title { color: inherit; }

/* Arabic mode: ensure popovers and tooltips use the Arabic site font */
body.arabic-mode .popover,
body.arabic-mode .popover .popover-header,
body.arabic-mode .popover .popover-body,
body.arabic-mode .ond-popover,
body.arabic-mode .tooltip,
body.arabic-mode .tooltip .tooltip-inner {
  font-family: 'Tajawal', 'Noto Sans Arabic', sans-serif !important;
}