/* ——— AI learning coach ——— */
@keyframes bd-lc-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes bd-lc-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* The coach shares the physical-left column with `.bd-expert-fab` (ارتباط با
   کارشناس), which is z-index 99998 against this 99990 — before the dock
   existed the expert pill was painted straight over the coach and the استاد
   هوشمند button was invisible and untappable on every plan platform.
   `--bd-dock-offset` is published per element by floating-assistant.js from
   the `data-bd-dock*` attributes set in bd-learning-coach.js; the fallbacks
   keep this correct on any page where that manager never runs. */
.bd-lc-fab {
  position: fixed;
  z-index: 99990;
  left: max(1rem, env(safe-area-inset-left, 0px));
  right: auto;
  bottom: calc(
    1.25rem + env(safe-area-inset-bottom, 0px) + var(--bd-bottom-furniture, 0px) +
      var(--bd-dock-offset, 0px)
  );
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.55rem 0.95rem 0.55rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #3d62b8 0%, #466dc4 48%, #5b82d6 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow:
    0 14px 34px rgba(50, 82, 160, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.bd-lc-fab:hover,
.bd-lc-fab:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 18px 38px rgba(50, 82, 160, 0.44),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset;
  outline: none;
}

.bd-lc-fab__pulse {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(70, 109, 196, 0.35);
  animation: bd-lc-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.bd-lc-fab__icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.bd-lc-fab__icon .bd-lc-ic {
  width: 1.15rem;
  height: 1.15rem;
}

/* NB the second selector used to read `..bd-conv-guide-app` (a stray leading
   dot). An invalid selector inside a selector list invalidates the WHOLE rule,
   so this block never applied at all and the FAB stayed on screen on top of
   its own open panel. */
body.has-bd-lc-open .bd-lc-fab,
body.bd-ec-open .bd-lc-fab,
body.bd-expert-form-open .bd-lc-fab,
body.bd-profile-sidebar-open .bd-lc-fab,
body.bd-pwa-banner-open .bd-lc-fab,
.bd-conv-guide-app.has-studio .bd-lc-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.bd-lc {
  position: fixed;
  inset: 0;
  z-index: 99991;
  display: grid;
  place-items: end stretch;
  pointer-events: none;
}

.bd-lc.is-open {
  pointer-events: auto;
}

.bd-lc__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 28, 52, 0.42);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.bd-lc.is-open .bd-lc__backdrop {
  opacity: 1;
}

.bd-lc__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(26.5rem, 100%);
  max-height: min(92vh, 44rem);
  margin-inline: 0 auto 0 0;
  margin-right: auto;
  margin-left: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 255, 0.98)),
    #f5f8ff;
  border-radius: 0 1.35rem 1.35rem 0;
  box-shadow: 18px 0 48px rgba(28, 46, 92, 0.22);
  transform: translateX(-108%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.bd-lc.is-open .bd-lc__panel {
  transform: translateX(0);
  animation: bd-lc-in 0.32s ease;
}

.bd-lc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(70, 109, 196, 0.12);
  background: linear-gradient(180deg, rgba(70, 109, 196, 0.1), transparent);
}

.bd-lc-daily {
  margin: 0 1rem 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #eef2ff;
  color: #312e81;
  font-size: 0.78rem;
  line-height: 1.45;
}

.bd-lc-daily-item {
  display: inline-block;
  margin-inline-start: 0.45rem;
  color: #3730a3;
  text-decoration: none;
}

.bd-lc__brand {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
}

.bd-lc__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.9rem;
  color: #fff;
  background: linear-gradient(145deg, #466dc4, #3557a5);
  box-shadow: 0 10px 20px rgba(70, 109, 196, 0.28);
}

.bd-lc__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1d2b4d;
  line-height: 1.25;
}

.bd-lc__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #5a6b90;
}

.bd-lc__close {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 0.8rem;
  background: rgba(70, 109, 196, 0.1);
  color: #3557a5;
  cursor: pointer;
}

.bd-lc__context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem 1rem 0.35rem;
}

.bd-lc__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(70, 109, 196, 0.08);
  color: #3d5078;
  font-size: 0.74rem;
}

.bd-lc__chip strong {
  color: #243764;
  font-weight: 800;
}

.bd-lc__chip.is-warn {
  background: rgba(214, 140, 48, 0.12);
  color: #8a5a12;
}

.bd-lc__chip.is-ok {
  background: rgba(29, 169, 124, 0.12);
  color: #0f7a58;
}

.bd-lc__chip.is-wallet {
  background: rgba(37, 99, 235, 0.1);
  color: #1e3a8a;
}

.bd-lc__chip.is-wallet.is-debiting strong {
  animation: bd-lc-wallet-flash 0.7s ease;
}

@keyframes bd-lc-wallet-flash {
  0% {
    color: #b91c1c;
  }
  100% {
    color: inherit;
  }
}

.bd-lc__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 1rem 0.7rem;
}

.bd-lc-quick {
  min-height: 2.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(70, 109, 196, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #3557a5;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

.bd-lc-quick:hover,
.bd-lc-quick:focus-visible {
  background: rgba(70, 109, 196, 0.08);
  border-color: rgba(70, 109, 196, 0.35);
  outline: none;
}

.bd-lc__thread {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow: auto;
  padding: 0.35rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scroll-behavior: smooth;
}

.bd-lc-msg {
  max-width: 94%;
  padding: 0.75rem 0.85rem;
  border-radius: 1rem;
  animation: bd-conv-panel-in 0.28s ease;
}

.bd-lc-msg.is-user {
  align-self: flex-start;
  background: linear-gradient(135deg, #466dc4, #3a5fb0);
  color: #fff;
  border-end-start-radius: 0.35rem;
}

.bd-lc-msg.is-assistant {
  align-self: flex-end;
  background: #fff;
  color: #243049;
  border: 1px solid rgba(70, 109, 196, 0.12);
  border-end-end-radius: 0.35rem;
  box-shadow: 0 8px 22px rgba(55, 78, 130, 0.08);
}

.bd-lc-msg.is-thinking {
  opacity: 0.78;
  font-style: italic;
}

.bd-lc-msg__body {
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.bd-lc-msg__block {
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(70, 109, 196, 0.18);
}

.bd-lc-msg__label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #466dc4;
  letter-spacing: 0.01em;
}

.bd-lc-msg__list {
  margin: 0;
  padding-inline-start: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.55;
}

.bd-lc-fix {
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.7rem;
  background: rgba(70, 109, 196, 0.05);
}

.bd-lc-fix__wrong {
  margin: 0;
  color: #b42318;
  font-size: 0.84rem;
}

.bd-lc-fix__ok {
  margin: 0.2rem 0 0;
  color: #0f7a58;
  font-weight: 700;
  font-size: 0.88rem;
}

.bd-lc-fix__note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #5a6b90;
}

.bd-lc-recs {
  display: grid;
  gap: 0.45rem;
}

.bd-lc-rec {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, rgba(70, 109, 196, 0.08), rgba(70, 109, 196, 0.02));
  border: 1px solid rgba(70, 109, 196, 0.14);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease;
}

.bd-lc-rec:hover,
.bd-lc-rec:focus-visible {
  border-color: rgba(70, 109, 196, 0.4);
  transform: translateY(-1px);
  outline: none;
}

.bd-lc-rec strong {
  font-size: 0.84rem;
  color: #2a4588;
}

.bd-lc-rec span {
  font-size: 0.75rem;
  color: #5a6b90;
  line-height: 1.45;
}

.bd-lc-follow {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed rgba(70, 109, 196, 0.35);
  border-radius: 0.7rem;
  background: rgba(70, 109, 196, 0.05);
  color: #3557a5;
  font: inherit;
  font-size: 0.8rem;
  text-align: start;
  cursor: pointer;
}

.bd-lc__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: end;
  padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(70, 109, 196, 0.12);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.bd-lc__input {
  width: 100%;
  min-height: 3rem;
  max-height: 7.5rem;
  resize: vertical;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(70, 109, 196, 0.2);
  border-radius: 0.9rem;
  background: #fff;
  color: #243049;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
}

.bd-lc__input:focus {
  outline: none;
  border-color: rgba(70, 109, 196, 0.55);
  box-shadow: 0 0 0 3px rgba(70, 109, 196, 0.15);
}

.bd-lc__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 3rem;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, #466dc4, #3557a5);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.bd-lc__send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.bd-lc__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bd-lc.is-busy .bd-lc-quick {
  pointer-events: none;
  opacity: 0.65;
}

@media (max-width: 720px) {
  .bd-lc-fab__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .bd-lc-fab {
    left: max(0.85rem, env(safe-area-inset-left, 0px));
    right: auto;
    /* Must repeat the furniture + dock terms: overriding `bottom` here with a
       bare value silently undid the whole stacking budget on phones, which is
       exactly the width where the launchers collide. */
    bottom: calc(
      1rem + env(safe-area-inset-bottom, 0px) + var(--bd-bottom-furniture, 0px) +
        var(--bd-dock-offset, 0px)
    );
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .bd-lc__panel,
  [dir='rtl'] .bd-lc__panel {
    width: 100%;
    max-height: min(94vh, 100%);
    border-radius: 1.2rem 1.2rem 0 0;
    transform: translateY(108%);
    box-shadow: 0 -16px 40px rgba(28, 46, 92, 0.22);
  }

  .bd-lc.is-open .bd-lc__panel,
  [dir='rtl'] .bd-lc.is-open .bd-lc__panel {
    transform: translateY(0);
  }

  .bd-lc {
    place-items: end stretch;
  }
}

