/* Hadith language control */
.hadith-language-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 96, 72, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(31, 96, 72, 0.08), rgba(255, 255, 255, 0.96));
  box-shadow: 0 8px 22px rgba(20, 48, 38, 0.08);
}

.hadith-language-toolbar.rtl {
  direction: rtl;
}

.hadith-language-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: #1f6048;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(31, 96, 72, 0.22);
}

.hadith-language-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.hadith-language-label {
  font-weight: 800;
  color: #173c30;
  white-space: nowrap;
}

.hadith-language-select-wrap {
  position: relative;
  display: block;
  min-width: 190px;
  max-width: 100%;
}

#hadithLanguageSelect {
  width: 100%;
  min-height: 44px;
  padding: 0 42px 0 14px;
  border: 1px solid rgba(31, 96, 72, 0.28);
  border-radius: 12px;
  background: #fff;
  color: #173c30;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.rtl #hadithLanguageSelect {
  padding: 0 14px 0 42px;
}

#hadithLanguageSelect:hover {
  border-color: #1f6048;
}

#hadithLanguageSelect:focus {
  outline: none;
  border-color: #1f6048;
  box-shadow: 0 0 0 4px rgba(31, 96, 72, 0.12);
}

.hadith-language-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-56%);
  pointer-events: none;
  color: #1f6048;
  font-size: 18px;
  font-weight: 900;
}

.rtl .hadith-language-chevron {
  right: auto;
  left: 14px;
}

/* Per-hadith English toggle */
.hadith-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.hadith-card-heading h3 {
  margin: 0;
}

.hadith-english-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(31, 96, 72, 0.25);
  border-radius: 999px;
  background: #fff;
  color: #1f6048;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.hadith-english-toggle:hover {
  transform: translateY(-1px);
  background: rgba(31, 96, 72, 0.08);
  box-shadow: 0 5px 14px rgba(31, 96, 72, 0.12);
}

.hadith-english-toggle.active {
  background: #1f6048;
  color: #fff;
  border-color: #1f6048;
}

.hadith-english-toggle-icon {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 22px;
  padding: 0 5px;
  border-radius: 7px;
  background: rgba(31, 96, 72, 0.12);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.hadith-english-toggle.active .hadith-english-toggle-icon {
  background: rgba(255, 255, 255, 0.18);
}

.hadith-source-line {
  opacity: 0.78;
  font-size: 0.88rem;
}

.hadith-text-body {
  line-height: 1.95;
  white-space: pre-line;
}

@media (max-width: 640px) {
  .hadith-language-toolbar {
    align-items: stretch;
  }

  .hadith-language-control {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  .hadith-language-label {
    white-space: normal;
  }

  .hadith-language-select-wrap {
    min-width: 0;
    width: 100%;
  }

  .hadith-card-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .hadith-english-toggle {
    align-self: flex-start;
  }

  .rtl .hadith-english-toggle {
    align-self: flex-end;
  }
}