/* ==========================================================================
   REAIM 2027 GLOBAL WIDGETS: MULTILANGUAGE SWITCHER + SECRETARIAT ASSISTANT
   Harmonized with REAIM Diplomatic Palette (Forest, Ivory, Ochre, Terracotta)
   ========================================================================== */

/* 1. Suppress Google Translate default top banner, hover highlights & layout shift cleanly */
body > .skiptranslate,
.skiptranslate > iframe.skiptranslate,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
iframe.skiptranslate,
.goog-te-gadget-icon,
#goog-gt-tt,
.goog-te-balloon-frame,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-aZ2wEe-OiiCO {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  position: fixed !important;
  top: -9999px !important;
  pointer-events: none !important;
}

html,
html.translated-ltr,
html.translated-rtl {
  height: auto !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body {
  top: 0 !important;
  margin-top: 0 !important;
  position: static !important;
}

/* Prevent Google Translate <font> wrappers from flickering or shifting top controls */
font,
.goog-text-highlight {
  background-color: transparent !important;
  box-shadow: none !important;
}

.reaim-masthead,
.reaim-masthead-inner,
.reaim-masthead-utility {
  contain: style;
}

.reaim-masthead-utility {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.reaim-masthead-utility > * {
  flex-shrink: 0;
}

html.translated-ltr .reaim-nav-list,
html.translated-rtl .reaim-nav-list {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none;
}

html.translated-ltr .reaim-nav-list::-webkit-scrollbar,
html.translated-rtl .reaim-nav-list::-webkit-scrollbar {
  display: none;
}

html.translated-ltr .reaim-nav-item,
html.translated-rtl .reaim-nav-item {
  white-space: nowrap !important;
  flex-shrink: 0;
}

#reaim_gt_hidden_mount {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 2. Diplomatic Language Switcher Pill in Masthead Utility Bar */
.reaim-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 1200;
}

.reaim-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  background: var(--ivory, #F7F4ED);
  border: 1px solid var(--rule, #D5D0C5);
  border-radius: 4px;
  color: var(--forest, #143D34);
  font-family: var(--font-body, 'Public Sans', system-ui, sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.reaim-lang-btn:hover,
.reaim-lang-btn[aria-expanded="true"] {
  background: #FFFFFF;
  border-color: var(--forest, #143D34);
  box-shadow: 0 2px 8px rgba(20, 61, 52, 0.1);
}

.reaim-lang-btn svg {
  flex-shrink: 0;
  color: var(--terracotta, #A14A32);
}

.reaim-lang-code {
  text-transform: uppercase;
}

.reaim-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  max-width: calc(100vw - 24px);
  background: #FFFFFF;
  border: 1px solid var(--rule, #D5D0C5);
  border-top: 3px solid var(--forest, #143D34);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(11, 36, 31, 0.18);
  padding: 10px;
  display: none;
  z-index: 2000;
}

.reaim-lang-menu.is-open {
  display: block;
  animation: reaimFadeDown 0.16s ease-out;
}

@keyframes reaimFadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.reaim-lang-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule, #D5D0C5);
}

.reaim-lang-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--forest, #143D34);
}

.reaim-lang-reset {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--terracotta, #A14A32);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
}

.reaim-lang-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--rule, #D5D0C5);
  border-radius: 4px;
  background: var(--ivory, #F7F4ED);
  font-size: 0.8rem;
  color: var(--ink, #1C2430);
  outline: none;
}

.reaim-lang-search:focus {
  border-color: var(--forest, #143D34);
  background: #FFFFFF;
}

.reaim-lang-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.reaim-lang-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink, #1C2430);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.14s ease;
}

.reaim-lang-item:hover {
  background: var(--ivory, #F7F4ED);
  color: var(--forest, #143D34);
}

.reaim-lang-item.is-active {
  background: rgba(20, 61, 52, 0.1);
  color: var(--forest, #143D34);
  font-weight: 700;
}

.reaim-lang-native {
  font-size: 0.74rem;
  color: var(--ink-soft, #4F5A68);
}

/* 3. REAIM 2027 Secretariat Assistant Chatbot */
.reaim-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1850;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #143D34 0%, #0B241F 100%);
  color: #F7F4ED;
  border: 1.5px solid #C49A4A;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(11, 36, 31, 0.32);
  font-family: var(--font-body, 'Public Sans', system-ui, sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reaim-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(11, 36, 31, 0.42);
}

.reaim-chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #C49A4A;
  box-shadow: 0 0 0 3px rgba(196, 154, 74, 0.28);
}

.reaim-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  width: 405px;
  max-width: calc(100vw - 24px);
  height: 590px;
  max-height: calc(100vh - 108px);
  z-index: 1900;
  background: #FAF8F3;
  border: 1px solid #C8C1B4;
  border-radius: 12px;
  box-shadow: 0 24px 58px rgba(11, 36, 31, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, 'Public Sans', system-ui, sans-serif);
  transition: width 0.22s ease, height 0.22s ease;
}

.reaim-chat-panel.is-expanded {
  width: 530px;
  height: 670px;
}

.reaim-chat-panel.is-open {
  display: flex;
  animation: reaimChatPop 0.2s ease-out;
}

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

.reaim-chat-flag {
  height: 4px;
  background: linear-gradient(90deg, #111111 0 32%, #FFFFFF 32% 35%, #BB1E28 35% 65%, #FFFFFF 65% 68%, #006633 68% 100%);
  flex-shrink: 0;
}

.reaim-chat-header {
  background: linear-gradient(135deg, #143D34 0%, #0B241F 100%);
  color: #F7F4ED;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #C49A4A;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.reaim-chat-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('/african-geometric.webp');
  background-repeat: repeat;
  background-size: 200px;
  opacity: 0.14;
  pointer-events: none;
}

.reaim-chat-header > * {
  position: relative;
  z-index: 1;
}

.reaim-chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reaim-chat-emblem {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(247, 244, 237, 0.96);
  padding: 3px;
  object-fit: contain;
  border: 1px solid #C49A4A;
  flex-shrink: 0;
}

.reaim-chat-header-title {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  color: #FFFFFF;
}

.reaim-chat-header-sub {
  font-size: 0.71rem;
  color: #E2C78B;
  margin-top: 2px;
}

.reaim-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.reaim-chat-icon-btn {
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.reaim-chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.reaim-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: #F7F4ED;
}

.reaim-msg {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 0.855rem;
  line-height: 1.56;
  word-wrap: break-word;
  animation: reaimMsgIn 0.16s ease-out;
}

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

.reaim-msg-bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: #1C2430;
  border: 1px solid #DFD9CC;
  border-left: 3px solid #143D34;
  box-shadow: 0 2px 7px rgba(20, 61, 52, 0.05);
}

.reaim-msg-user {
  align-self: flex-end;
  background: #143D34;
  color: #FFFFFF;
  border-bottom-right-radius: 3px;
}

.reaim-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0;
}

.reaim-fact-card {
  background: #FAF8F3;
  border: 1px solid #DFD9CC;
  border-top: 2px solid #C49A4A;
  border-radius: 5px;
  padding: 7px 9px;
}

.reaim-fact-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #A14A32;
  font-weight: 700;
}

.reaim-fact-val {
  font-size: 0.84rem;
  font-weight: 700;
  color: #143D34;
  margin-top: 1px;
}

.reaim-fact-sub {
  font-size: 0.7rem;
  color: #4F5A68;
}

.reaim-followup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed #DFD9CC;
}

.reaim-followup-chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #CFC8BA;
  background: #FAF8F3;
  color: #143D34;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.reaim-followup-chip:hover {
  background: #143D34;
  color: #FFFFFF;
  border-color: #143D34;
}

.reaim-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 13px;
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid #DFD9CC;
  border-left: 3px solid #C49A4A;
  border-radius: 10px;
}

.reaim-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #143D34;
  opacity: 0.35;
  animation: reaimDot 1s infinite ease-in-out;
}

.reaim-typing span:nth-child(2) { animation-delay: 0.16s; }
.reaim-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes reaimDot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.35; }
  40% { transform: scale(1.15); opacity: 1; background: #A14A32; }
}

.reaim-chat-suggest {
  background: #FFFFFF;
  border-top: 1px solid #DDD7CA;
  padding: 5px 10px;
  display: none;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.reaim-chat-suggest.is-open {
  display: flex;
}

.reaim-suggest-item {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #143D34;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reaim-suggest-item:hover {
  background: #F7F4ED;
  color: #A14A32;
}

.reaim-msg-bot p {
  margin: 0 0 7px;
}

.reaim-msg-bot p:last-child {
  margin-bottom: 0;
}

.reaim-msg-bot ul {
  margin: 5px 0 7px;
  padding-left: 17px;
}

.reaim-msg-bot li {
  margin-bottom: 4px;
}

.reaim-msg-bot a {
  color: #A14A32;
  font-weight: 700;
  text-decoration: underline;
}

.reaim-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.reaim-msg-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 4px;
  background: #F7F4ED;
  border: 1px solid #143D34;
  color: #143D34 !important;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none !important;
}

.reaim-msg-link-btn:hover {
  background: #143D34;
  color: #FFFFFF !important;
}

.reaim-msg-link-btn.is-primary {
  background: #A14A32;
  border-color: #A14A32;
  color: #FFFFFF !important;
}

.reaim-msg-link-btn.is-primary:hover {
  background: #873A25;
}

.reaim-chat-chips {
  padding: 8px 12px;
  background: #EFECE3;
  border-top: 1px solid #DDD7CA;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.reaim-chat-chips::-webkit-scrollbar {
  display: none;
}

.reaim-chip {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #C8C1B4;
  background: #FFFFFF;
  color: #143D34;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaim-chip:hover {
  background: #143D34;
  color: #FFFFFF;
  border-color: #143D34;
}

.reaim-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #FFFFFF;
  border-top: 1px solid #DDD7CA;
  flex-shrink: 0;
}

.reaim-chat-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #CFC8BA;
  border-radius: 6px;
  background: #FAF8F3;
  font-size: 0.85rem;
  color: #1C2430;
  outline: none;
}

.reaim-chat-input:focus {
  border-color: #143D34;
  background: #FFFFFF;
}

.reaim-chat-send {
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  background: #143D34;
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.reaim-chat-send:hover {
  background: #A14A32;
}

@media (max-width: 600px) {
  .reaim-chat-launcher {
    right: 14px;
    bottom: 14px;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .reaim-chat-panel {
    right: 10px;
    left: 10px;
    bottom: 68px;
    width: auto;
    height: 74vh;
  }

  .reaim-lang-btn {
    padding: 0 8px;
    font-size: 0.74rem;
  }
}
