/* Asistentul: un panou pe calculator, o foaie pe tot ecranul pe telefon. */

.chat-launcher {
  position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 46;
  display: none; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 18px 0 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--anth); color: var(--on-dark);
  font-family: var(--f-text); font-weight: 600; font-size: 1rem;
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.7);
  transition: transform .3s var(--ease-out), background-color .25s var(--ease-out);
}
.chat-launcher:hover { background: #000; }
.chat-launcher-fob {
  width: 22px; height: 34px; border-radius: 50%;
  background: linear-gradient(165deg, var(--alu-hi), var(--alu) 50%, var(--alu-lo));
  box-shadow: inset 0 0 0 1.5px #151417;
  position: relative; overflow: hidden;
}
.chat-launcher-fob::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: #151417; }
/* Pe laptopuri înguste, „Întrebări?” stă deasupra butonului de WhatsApp; de la 1280 px, lângă el. */
@media (min-width: 960px) { .chat-launcher { display: inline-flex; right: 24px; bottom: 100px; } }
@media (min-width: 1280px) { .chat-launcher { right: 100px; bottom: 30px; } }

/* Butonul rotund de WhatsApp, colțul din dreapta jos. */
.wa-float {
  position: fixed; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 47;
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: #25D366; color: #fff;
  box-shadow: 0 12px 26px -10px rgba(10, 60, 30, 0.75), 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform .3s var(--ease-out), background-color .25s var(--ease-out);
}
.wa-float svg { width: 30px; height: 30px; }
.wa-float:hover { background: #1ebe5b; transform: translateY(-2px); }
.wa-float:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (min-width: 960px) {
  .wa-float { right: 24px; bottom: 24px; width: 64px; height: 64px; }
  .wa-float svg { width: 32px; height: 32px; }
}
.chat-is-open .wa-float { transform: scale(0); pointer-events: none; }
@media (min-width: 960px) { .chat-is-open .wa-float { transform: none; pointer-events: auto; } }
.chat-is-open .chat-launcher { transform: translateY(160%); }
@media (min-width: 960px) { .chat-is-open .chat-launcher { transform: none; } }
.chat-is-open .dock { transform: translateY(110%); }

.chat {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.chat[hidden] { display: none; }
@media (min-width: 960px) {
  .chat {
    inset: auto 24px 170px auto; width: 400px; height: min(620px, calc(100svh - 210px));
    border-radius: 24px; overflow: hidden;
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(29, 27, 30, 0.08);
  }
}
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 16px 14px 20px; background: var(--anth); color: var(--on-dark);
}
.chat-title { font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; line-height: 1.1; }
.chat-sub { margin-top: 4px; font-size: 0.86rem; line-height: 1.35; color: var(--on-dark-soft); }
.chat-close {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line-dark);
  background: transparent; color: var(--on-dark); display: grid; place-items: center; cursor: pointer;
}
.chat-close:hover { background: var(--on-dark); color: var(--anth); }
.chat :focus-visible { outline-color: var(--brick); }
.chat-head :focus-visible { outline-color: var(--alu-hi); }

.chat-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { display: flex; }
.msg p { max-width: 86%; padding: 10px 14px; border-radius: 18px; white-space: pre-line; font-size: 0.99rem; line-height: 1.45; }
.msg.bot p { background: #ECEAE6; border-bottom-left-radius: 6px; }
.msg.user { justify-content: flex-end; }
.msg.user p { background: var(--anth); color: var(--on-dark); border-bottom-right-radius: 6px; }
.msg.typing p { display: flex; gap: 4px; padding: 14px 16px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: #8d8a86; animation: dot 1s infinite ease-in-out; }
.msg.typing i:nth-child(2) { animation-delay: .15s; }
.msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 12px; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid rgba(29, 27, 30, 0.22); background: transparent; color: var(--ink);
  font-family: var(--f-text); font-weight: 600; font-size: 0.93rem; text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.chip:hover { border-color: var(--ink); }
.chip-primary { background: var(--brick); border-color: var(--brick); color: #fff; }
.chip-primary:hover { background: var(--brick-deep); border-color: var(--brick-deep); }
.chip-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.chip-wa:hover { background: var(--wa-deep); border-color: var(--wa-deep); }

.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--paper); }
.chat-form input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid rgba(29, 27, 30, 0.2); background: #fff; color: var(--ink);
  font-family: var(--f-text); font-size: 16px;
}
.chat-form input::placeholder { color: #6e6a66; }
.chat-form input:focus { outline: none; border-color: var(--ink); }
.chat-form button {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brick); color: #fff; display: grid; place-items: center;
}
.chat-form button:hover { background: var(--brick-deep); }

/* De la 1280 px, butoanele stau unul lângă altul, deci panoul coboară. */
@media (min-width: 1280px) { .chat { bottom: 100px; height: min(620px, calc(100svh - 140px)); } }
