/* ==========================================================================
   508 Ministry Compass & Dove Social - Live Multilingual i18n UI Styles
   Self-hosted Cormorant + Figtree palette (Navy / Gold / Ivory)
   Zero horizontal overflow on Desktop (1440px) & Mobile (390px)
   ========================================================================== */

/* Global Icon Sizing Guard */
svg.s508-globe {
  width: 15px;
  height: 15px;
  min-width: 15px;
  max-width: 15px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.s508-feed-lang-bar svg.s508-globe {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  color: #FFE89E;
}
.s508-cl-lbl svg.s508-globe,
.s508-sl-lbl svg.s508-globe {
  width: 14px;
  height: 14px;
  min-width: 14px;
  max-width: 14px;
  color: #9A6E12;
}

/* Top Nav Language Switcher */
.s508-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.s508-lang-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(212, 168, 75, 0.58);
  background: rgba(255, 255, 255, 0.11);
  color: #FFFDF7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.6px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.14s ease, box-shadow 0.15s ease;
}
.s508-lang-btn:hover {
  background: rgba(212, 168, 75, 0.22);
  border-color: #FFE89E;
  transform: translateY(-1px);
}
.s508-lang-btn[aria-expanded="true"],
.s508-lang-btn.is-translated {
  background: rgba(212, 168, 75, 0.26);
  border-color: #FFE89E;
  color: #FFE89E;
  box-shadow: 0 3px 12px rgba(212, 168, 75, 0.25);
}
.s508-lang-btn svg.s508-globe {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #FFE89E;
}
.s508-lang-btn svg.s508-chev {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: transform 0.16s ease;
}
.s508-lang-btn[aria-expanded="true"] svg.s508-chev {
  transform: rotate(180deg);
}
.s508-lang-label-short {
  display: none;
}

/* Global Language Dropdown Menu */
.s508-lang-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(410px, calc(100vw - 20px));
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  background: #FFFFFF;
  border: 1.5px solid #D4A84B;
  border-radius: 18px;
  box-shadow: 0 22px 54px rgba(10, 16, 38, 0.34);
  display: none;
  z-index: 1085;
  color: #141C38;
}
.s508-lang-menu.open {
  display: block;
  animation: s508LangPop 0.16s ease-out;
}
@keyframes s508LangPop {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.s508-lm-head {
  padding: 13px 16px 11px;
  background: linear-gradient(100deg, #141C38 0%, #1E2A52 100%);
  color: #FFFFFF;
  border-bottom: 1.5px solid #D4A84B;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.s508-lm-title {
  font-family: 'Cormorant', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.08;
  color: #FFFFFF;
}
.s508-lm-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #FFE89E;
  margin-top: 2px;
}
.s508-lm-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.s508-lm-close:hover {
  background: #D4A84B;
  color: #141C38;
}

.s508-lm-body {
  padding: 12px 14px 14px;
}
.s508-lm-sec-lbl {
  font-size: 10.6px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6B7D99;
  margin: 2px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.s508-lm-sec-pill {
  font-size: 9.8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #FFF6DC;
  color: #8A6112;
  border: 1px solid #E5C878;
  text-transform: none;
  letter-spacing: 0.02em;
}

.s508-lm-active-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.s508-lm-item {
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid #E4ECF5;
  background: #FAFBFD;
  color: #141C38;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, transform 0.12s ease;
}
.s508-lm-item:hover {
  background: #FFFBF0;
  border-color: #D4A84B;
}
.s508-lm-item.is-selected {
  background: linear-gradient(95deg, #141C38 0%, #1E2A52 100%);
  border-color: #D4A84B;
  color: #FFFFFF;
}
.s508-lm-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.s508-lm-code {
  min-width: 34px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  background: #EAF1FA;
  color: #1E2A52;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.s508-lm-item.is-selected .s508-lm-code {
  background: rgba(212, 168, 75, 0.25);
  color: #FFE89E;
  border: 1px solid rgba(255, 232, 158, 0.5);
}
.s508-lm-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.s508-lm-native {
  font-size: 13.4px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s508-lm-region {
  font-size: 11px;
  color: #5C6F8C;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s508-lm-item.is-selected .s508-lm-region {
  color: #D6E4F7;
}
.s508-lm-check {
  font-size: 14px;
  font-weight: 900;
  color: #FFE89E;
  flex-shrink: 0;
}

.s508-lm-global-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.s508-lm-chip {
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid #E4ECF5;
  background: #FFFFFF;
  color: #141C38;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  transition: border-color 0.13s ease, background 0.13s ease;
}
.s508-lm-chip:hover {
  border-color: #D4A84B;
  background: #FFFBF0;
}
.s508-lm-chip.is-selected {
  background: #141C38;
  color: #FFE89E;
  border-color: #D4A84B;
}
.s508-lm-chip-name {
  font-size: 12.2px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s508-lm-chip-sub {
  font-size: 10.3px;
  color: #6B7D99;
  flex-shrink: 0;
}
.s508-lm-chip.is-selected .s508-lm-chip-sub {
  color: #DCEAFB;
}

/* Hamburger Menu Quick Language Section */
.s508-hm-lang {
  background: #FAFBFD;
  border: 1px solid #E2EAF4;
  border-radius: 14px;
  padding: 10px 11px;
  margin-bottom: 12px;
}
.s508-hm-lang-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.s508-hm-lang-title {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #1E2A52;
}
.s508-hm-lang-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.s508-hm-pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #D3DFEE;
  background: #FFFFFF;
  color: #1E2A52;
  font-size: 11.6px;
  font-weight: 800;
  cursor: pointer;
}
.s508-hm-pill:hover {
  border-color: #D4A84B;
  background: #FFFBF0;
}
.s508-hm-pill.is-selected {
  background: #141C38;
  color: #FFE89E;
  border-color: #D4A84B;
}
.s508-hm-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #CBD8E8;
  background: #FFFFFF;
  color: #141C38;
  font-size: 12.4px;
  font-weight: 700;
}

/* Live Feed Status Translation Banner */
.s508-feed-lang-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: linear-gradient(95deg, #141C38 0%, #1E2A52 100%);
  border: 1.5px solid #D4A84B;
  color: #FFFFFF;
  font-size: 12.8px;
  font-weight: 700;
}
.s508-feed-lang-bar.show {
  display: flex;
}
.s508-feed-lang-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.s508-feed-lang-reset {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 232, 158, 0.65);
  background: rgba(255, 255, 255, 0.12);
  color: #FFE89E;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.s508-feed-lang-reset:hover {
  background: #D4A84B;
  color: #141C38;
}

/* Per-Post Quick Language Picker */
.s508-post-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.s508-post-lang-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #D5E0EE;
  background: #F6F9FD;
  color: #1E2A52;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.s508-post-lang-btn:hover {
  border-color: #D4A84B;
  background: #FFFBF0;
}
.s508-post-lang-btn.is-active {
  background: #141C38;
  color: #FFE89E;
  border-color: #D4A84B;
}
.s508-post-lang-btn svg {
  width: 13px;
  height: 13px;
}

.s508-post-pop {
  position: fixed;
  z-index: 1200;
  width: min(268px, calc(100vw - 24px));
  background: #FFFFFF;
  border: 1.5px solid #D4A84B;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(10, 16, 38, 0.28);
  padding: 10px;
  display: none;
  color: #141C38;
}
.s508-post-pop.open {
  display: block;
  animation: s508LangPop 0.14s ease-out;
}
.s508-post-pop-hd {
  font-size: 10.6px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.s508-post-pop-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.s508-post-pop-item {
  width: 100%;
  text-align: left;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid #E8EFF7;
  background: #FAFBFD;
  color: #141C38;
  font-size: 12.2px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.s508-post-pop-item:hover {
  border-color: #D4A84B;
  background: #FFFBF0;
}
.s508-post-pop-item.is-selected {
  background: #141C38;
  color: #FFE89E;
  border-color: #D4A84B;
}
.s508-post-pop-item small {
  font-size: 10.4px;
  font-weight: 600;
  color: #64748B;
}
.s508-post-pop-item.is-selected small {
  color: #D6E4F7;
}
.s508-post-pop-more {
  width: 100%;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid #CBD8E8;
  background: #FFFFFF;
  color: #141C38;
  font-size: 12px;
  font-weight: 700;
}

/* Translated Pill Inside Post Card */
.s508-tr-pill-row {
  padding: 0 16px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.s508-tr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FFF9E9;
  border: 1px solid #E5C878;
  color: #6B4D0E;
  font-size: 11.4px;
  font-weight: 800;
  line-height: 1.3;
}
.s508-tr-pill.is-loading {
  background: #EFF5FC;
  border-color: #BDD2EA;
  color: #264B7A;
}
.s508-tr-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-left: 2px;
  color: #141C38;
  font-size: 11.4px;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
}
.s508-tr-toggle:hover {
  color: #9A6E12;
}

/* Composer Posting Language Bar */
.s508-composer-lang {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: linear-gradient(95deg, #F5F8FD 0%, #FFFBF0 100%);
  border: 1px solid #DFC888;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.s508-cl-lbl {
  font-size: 12px;
  font-weight: 800;
  color: #141C38;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.s508-cl-select {
  flex: 1;
  min-width: 170px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #C5D4E6;
  background: #FFFFFF;
  color: #141C38;
  font-size: 12.6px;
  font-weight: 700;
}
.s508-cl-btn {
  padding: 7px 13px;
  border-radius: 10px;
  border: 1.5px solid #D4A84B;
  background: linear-gradient(135deg, #141C38 0%, #1E2A52 100%);
  color: #FFE89E;
  font-size: 12.4px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.14s ease;
}
.s508-cl-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.s508-cl-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.s508-cl-undo {
  display: none;
  background: none;
  border: none;
  color: #2E72A1;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}
.s508-cl-undo.show {
  display: inline-block;
}
.s508-cl-status {
  width: 100%;
  font-size: 11.6px;
  font-weight: 700;
  color: #166534;
  display: none;
}
.s508-cl-status.show {
  display: block;
}
.s508-cl-status.is-err {
  color: #991B1B;
}

/* Share Everywhere Modal Language Switcher */
.s508-share-lang {
  margin-bottom: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  background: linear-gradient(95deg, #F6F9FE 0%, #FFFBF0 100%);
  border: 1.5px solid #DFC888;
}
.s508-sl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.s508-sl-lbl {
  font-size: 12.2px;
  font-weight: 900;
  color: #141C38;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.s508-sl-select {
  flex: 1;
  min-width: 170px;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #C5D4E6;
  background: #FFFFFF;
  color: #141C38;
  font-size: 12.4px;
  font-weight: 800;
}
.s508-sl-ta {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  border: 1px solid #CCD9E8;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.8px;
  line-height: 1.45;
  color: #141C38;
  background: #FFFFFF;
}
.s508-sl-foot {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.s508-sl-note {
  font-size: 11.2px;
  font-weight: 700;
  color: #166534;
}
.s508-sl-copy {
  padding: 6px 12px;
  border-radius: 9px;
  border: none;
  background: #141C38;
  color: #FFE89E;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
}
.s508-sl-copy:hover {
  background: #1E2A52;
}

/* Mobile Responsive (390px zero-overflow lock) */
@media (max-width: 720px) {
  .s508-lang-label-full {
    display: none;
  }
  .s508-lang-label-short {
    display: inline;
  }
  .s508-lang-btn {
    padding: 0 9px;
    gap: 4px;
    font-size: 11.8px;
  }
}

@media (max-width: 560px) {
  .s508-lang-btn {
    height: 32px;
    padding: 0 7px;
    font-size: 11px;
    gap: 3px;
  }
  .s508-lang-btn svg.s508-globe {
    width: 13px;
    height: 13px;
  }
  .s508-lang-btn svg.s508-chev {
    width: 10px;
    height: 10px;
  }
  .s508-lang-menu {
    position: fixed;
    top: calc(var(--nav-h, 66px) + 6px);
    left: 10px;
    right: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 82px);
  }
  .s508-lm-global-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .s508-composer-lang {
    padding: 8px 9px;
  }
  .s508-cl-select {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }
  .s508-cl-btn {
    width: 100%;
  }
  .s508-sl-select {
    max-width: 100%;
    width: 100%;
  }
}
