/* ───── BADR AI — Liquid Glass Concierge ─────
   Scoped under .badr-chat-root. No external dependencies.
   Emerald (#10b981) + Gold (#d4af37) on deep dark glass. */

.badr-chat-root {
  --bc-em: #10b981;
  --bc-em-dim: rgba(16,185,129,.12);
  --bc-em-border: rgba(16,185,129,.2);
  --bc-em-glow: rgba(16,185,129,.4);
  --bc-gold: #d4af37;
  --bc-gold-dim: rgba(212,175,55,.1);
  --bc-gold-border: rgba(212,175,55,.2);
  --bc-sand: #fbf9f1;
  --bc-dark: #03170d;
  --bc-deep: #010a05;
  --bc-font: var(--f-sans,'Manrope',system-ui,sans-serif);
  --bc-serif: var(--f-serif,'EB Garamond',Georgia,serif);
}
[dir="rtl"] .badr-chat-root {
  --bc-font: var(--f-sans,'IBM Plex Sans Arabic',system-ui,sans-serif);
  --bc-serif: var(--f-serif,'Amiri',Georgia,serif);
}

/* ── Capsule trigger ── */
.bc-capsule {
  position: fixed;
  bottom: 32px;
  inset-inline-end: 32px;
  background: linear-gradient(135deg, #2a3d32 0%, #354a3e 50%, #2a3d32 100%);
  border: 2px solid rgba(201,168,76,.45);
  border-radius: 60px;
  padding-block: 8px;
  padding-inline: 10px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: start;
  cursor: pointer;
  z-index: 9999;
  box-shadow:
    0 8px 32px rgba(0,0,0,.4),
    0 0 24px rgba(201,168,76,.15),
    inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .5s cubic-bezier(.34,1.56,.64,1), opacity .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.bc-capsule:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(201,168,76,.7);
  box-shadow:
    0 12px 40px rgba(0,0,0,.5),
    0 0 36px rgba(201,168,76,.25),
    inset 0 1px 0 rgba(255,255,255,.12);
}
.bc-capsule:focus-visible { outline: 2px solid #c9a84c; outline-offset: 3px; }
.bc-capsule.is-hidden {
  opacity: 0; pointer-events: none; visibility: hidden;
  transform: translateY(40px) scale(.8);
  transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
}

.bc-capsule-spark {
  color: #c9a84c;
  flex-shrink: 0;
  opacity: .7;
}
.bc-capsule-spark svg { width: 18px; height: 18px; }

.bc-capsule-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.bc-capsule-text .title {
  color: var(--bc-sand);
  font-family: var(--bc-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
}
.bc-capsule:hover .bc-capsule-text .title { color: #f3e5ab; }
.bc-capsule-text .sub {
  color: rgba(201,168,76,.55);
  font-family: var(--bc-font);
  font-size: 11px;
  letter-spacing: .06em;
  line-height: 1.2;
}

/* ── Window ── */
.bc-window {
  position: fixed;
  bottom: 32px;
  inset-inline-end: 32px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: min(720px, calc(100vh - 64px));
  background: #2b3e34;
  border: 1px solid rgba(255,255,255,.08);
  border-top-color: rgba(255,255,255,.12);
  border-radius: 44px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(60px) scale(.9);
  transform-origin: bottom right;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
}
.bc-window.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── The Badr Majlis — editorial title, manuscript-inspired caption ── */
.bc-header {
  position: relative;
  top: auto;
  z-index: auto;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 26px 22px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(217,186,108,.08), transparent 65%),
    linear-gradient(135deg, #10291f, #0a1d17);
  border-bottom: 1px solid rgba(217,186,108,.22);
  flex-shrink: 0;
}
.bc-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-inline-size: 0;
}
.bc-header-heading {
  min-inline-size: 0;
  text-align: start;
}
.bc-header-title {
  font-family: var(--f-display, 'Cinzel', serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--gold-3, #F0DCA3);
  letter-spacing: .035em;
  margin: 0;
}
.bc-header-quote {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
}
.bc-header-quote p {
  margin: 0;
  font-family: var(--bc-serif);
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  color: #C7C4B2;
  text-wrap: pretty;
}
.bc-header-quote cite {
  display: block;
  margin-block-start: 3px;
  font-family: var(--bc-font);
  font-size: 9px;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: .06em;
  color: #AEB7A9;
}
.badr-chat-root[data-locale="ar"] .bc-header-title {
  font-family: var(--f-ar, 'Amiri', serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0;
}
.badr-chat-root[data-locale="ar"] .bc-header-quote p {
  font-style: normal;
  font-size: 16px;
  line-height: 1.6;
}
.badr-chat-root[data-locale="ar"] .bc-header-quote cite { letter-spacing: 0; }

.bc-close-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(217,186,108,.045);
  border: 1px solid rgba(217,186,108,.18);
  display: flex; align-items: center; justify-content: center;
  color: #CEBD91;
  flex-shrink: 0;
  cursor: pointer;
  transition: all .25s;
}
.bc-close-btn:hover { background: rgba(217,186,108,.12); color: var(--gold-3, #F0DCA3); }
.bc-close-btn:focus-visible { outline: 2px solid var(--bc-em); outline-offset: 2px; }
.bc-close-btn svg { width: 12px; height: 12px; }

/* ── Messages ── */
.bc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #2b3e34;
}
.bc-messages::-webkit-scrollbar { width: 4px; }
.bc-messages::-webkit-scrollbar-track { background: transparent; }
.bc-messages::-webkit-scrollbar-thumb { background: rgba(212,175,55,.2); border-radius: 10px; }

.bc-msg {
  max-width: 85%;
  animation: bcMsgIn .45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes bcMsgIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AI message — emerald glass */
.bc-msg.ai {
  align-self: flex-start;
  padding: 16px 20px;
  border-radius: 24px;
  border-start-start-radius: 4px;
  background: #1e3a2a;
  border: 1px solid rgba(16,185,129,.15);
}
.bc-msg.ai p {
  margin: 0 0 10px;
  color: var(--bc-sand);
  font-family: var(--bc-font);
  font-size: 15px;
  line-height: 1.68;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.bc-msg.ai p:last-child { margin-bottom: 0; }
.bc-msg.ai strong {
  font-weight: 650;
  color: #FFFFFF;
}
.bc-msg.ai .bc-list {
  margin: 0 0 10px;
  padding-inline-start: 20px;
  display: grid;
  gap: 6px;
  color: var(--bc-sand);
  font-family: var(--bc-font);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.bc-msg.ai .bc-list:last-child { margin-bottom: 0; }
.bc-msg.ai .bc-list li { padding-inline-start: 2px; }
.bc-msg.ai .bc-list li::marker { color: var(--bc-em); }
.bc-msg.ai .bc-sub {
  color: rgba(16,185,129,.8);
  font-family: var(--bc-font);
  font-size: 13px;
  font-weight: 300;
  margin-top: 10px;
}

/* User message — white glass */
.bc-msg.user {
  align-self: flex-end;
  padding: 16px 20px;
  border-radius: 24px;
  border-start-end-radius: 4px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
}
.bc-msg.user p {
  margin: 0;
  color: var(--bc-sand);
  font-family: var(--bc-font);
  font-size: 15px;
  line-height: 1.7;
}

/* Status / loading */
.bc-status {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 24px;
  border-start-start-radius: 4px;
  background: #1e3a2a;
  border: 1px solid rgba(16,185,129,.15);
}
.bc-dots {
  display: flex;
  gap: 4px;
}
.bc-dots span {
  width: 6px; height: 6px;
  background: var(--bc-em);
  border-radius: 50%;
  animation: bcBounce 1.2s ease-in-out infinite;
}
.bc-dots span:nth-child(2) { animation-delay: .1s; }
.bc-dots span:nth-child(3) { animation-delay: .2s; }
@keyframes bcBounce {
  0%,80%,100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
}
.bc-status-text {
  color: rgba(16,185,129,.6);
  font-family: var(--bc-font);
  font-size: 12px;
  letter-spacing: .04em;
}

/* ── Suggestion chips ── */
.bc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 24px 12px;
  justify-content: center;
}
.bc-chips:empty { display: none; }
.bc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--bc-font);
  font-size: 12px;
  cursor: pointer;
  transition: all .3s;
  white-space: normal;
  max-inline-size: 100%;
  text-align: start;
}
.bc-chip.em {
  background: rgba(16,185,129,.12);
  border: 1px solid rgba(16,185,129,.25);
  color: var(--bc-em);
}
.bc-chip.em:hover {
  background: rgba(16,185,129,.2);
  border-color: rgba(16,185,129,.4);
}
.bc-chip.gold {
  background: rgba(212,175,55,.1);
  border: 1px solid rgba(212,175,55,.25);
  color: var(--bc-gold);
}
.bc-chip.gold:hover {
  background: rgba(212,175,55,.2);
  border-color: rgba(212,175,55,.4);
}
.bc-chip:focus-visible { outline: 2px solid var(--bc-em); outline-offset: 2px; }
.bc-chip svg { width: 12px; height: 12px; opacity: .7; }

/* ── Input dock ── */
.bc-dock {
  padding: 18px 20px 20px;
  background: #1c2e22;
  border-top: 1px solid rgba(255,255,255,.05);
  border-radius: 0 0 44px 44px;
  flex-shrink: 0;
}
.bc-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.bc-input-glow {
  position: absolute;
  inset: -2px;
  background: linear-gradient(to right, rgba(16,185,129,.15), rgba(212,175,55,.15));
  border-radius: 24px;
  filter: blur(8px);
  opacity: .4;
  pointer-events: none;
}
.bc-input {
  width: 100%;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 14px 56px 14px 22px;
  color: var(--bc-sand);
  font-family: var(--bc-font);
  font-size: 15px;
  position: relative;
  z-index: 1;
  resize: none;
  min-height: 50px;
  max-height: 110px;
  overflow-y: auto;
  transition: all .3s;
}
.bc-input::placeholder { color: rgba(255,255,255,.3); }
.bc-input:focus {
  outline: none;
  border-color: rgba(16,185,129,.5);
  background: rgba(0,0,0,.6);
}
.bc-input:disabled { opacity: .5; }

.bc-send {
  position: absolute;
  inset-inline-end: 6px;
  width: 40px; height: 40px;
  background: var(--bc-em);
  border: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: all .3s;
  box-shadow: 0 0 15px rgba(16,185,129,.4);
  z-index: 2;
}
.bc-send:hover {
  background: rgba(16,185,129,.8);
  transform: scale(1.05);
}
.bc-send:active { transform: scale(.95); }
.bc-send:focus-visible { outline: 2px solid var(--bc-em); outline-offset: 2px; }
.bc-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.bc-send svg { width: 15px; height: 15px; }
[dir="rtl"] .bc-send svg { transform: scaleX(-1); }



/* Original blue/violet silk orb. Motion and reduced-motion fallback live
   inside the self-hosted SVG so both instances share the same artwork. */
.badr-chat-root .bc-orb {
  --bc-orb-size: 64px;
  inline-size: var(--bc-orb-size);
  block-size: var(--bc-orb-size);
  flex: 0 0 var(--bc-orb-size);
  display: block;
  pointer-events: none;
}
.badr-chat-root .bc-orb img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 7px rgba(70,95,255,.2));
}
.badr-chat-root .bc-header-emblem { --bc-orb-size: 56px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .bc-capsule {
    bottom: 16px;
    inset-inline-end: 16px;
    padding-block: 7px;
    padding-inline: 8px 18px;
    gap: 10px;
  }
  .bc-capsule-spark svg { width: 14px; height: 14px; }
  .badr-chat-root .bc-capsule .bc-orb { --bc-orb-size: 56px; }
  .bc-capsule-text .title { font-size: 14px; }
  .bc-capsule-text .sub { font-size: 10px; }

  .bc-window {
    bottom: 0;
    inset-inline-end: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-start-start-radius: 28px;
    border-start-end-radius: 28px;
    border-inline: 0;
    border-bottom: 0;
    transform-origin: bottom center;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bc-header { padding: 22px 16px 18px; gap: 10px; }
  .bc-header-left { gap: 12px; }
  .badr-chat-root .bc-header-emblem { --bc-orb-size: 48px; }
  .bc-header-title { font-size: 18px; }
  .badr-chat-root[data-locale="ar"] .bc-header-title { font-size: 25px; }
  .bc-messages { padding: 14px; gap: 12px; }
  .bc-msg.ai p, .bc-msg.user p { font-size: 14px; }
  .bc-chip { padding: 7px 13px; font-size: 11px; }
  .bc-dock {
    padding: 12px 12px max(12px, env(safe-area-inset-bottom, 12px));
    border-radius: 0;
  }
  .bc-input {
    padding: 12px 52px 12px 18px;
    font-size: 16px;
    /* 16px prevents iOS zoom */
  }
  .bc-send { width: 38px; height: 38px; inset-inline-end: 5px; }
  .bc-close-btn { width: 30px; height: 30px; }
  .bc-powered { display: none; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .bc-capsule,
  .bc-window, .bc-window.is-active, .bc-msg,
  .bc-dots span, .bc-chip {
    animation: none !important;
    transition: none !important;
  }
  .bc-window.is-active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

/* ── Powered by ── */
.bc-powered {
  text-align: center;
  margin-top: 10px;
  color: rgba(255,255,255,.3);
  font-family: var(--bc-font);
  font-size: 9px;
  letter-spacing: .3em;
  text-transform: uppercase;
}
[dir="rtl"] .bc-powered { letter-spacing: .05em; text-transform: none; }
