/* ===== Yönlendirme asistanı: başlatma butonu, tek seferlik davet, sohbet paneli ===== */

/* Başlatma butonu */
.as-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  width: 58px; height: 58px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--orange); color: var(--night);
  box-shadow: 0 12px 30px -8px rgba(255, 106, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .4s, transform .4s cubic-bezier(.2, .8, .2, 1), background-color .2s;
}
.as-launcher.is-ready { opacity: 1; transform: none; pointer-events: auto; }
.as-launcher.is-ready.is-away { opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none; }
.as-launcher:hover { background: var(--orange-hover); }
.as-launcher .icon { grid-area: 1 / 1; width: 26px; height: 26px; transition: transform .3s, opacity .2s; }
.as-launcher .i-close { opacity: 0; transform: rotate(-90deg); }
.as-launcher[aria-expanded="true"] .i-open { opacity: 0; transform: rotate(90deg); }
.as-launcher[aria-expanded="true"] .i-close { opacity: 1; transform: none; }
.as-launcher.has-ping::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--orange); animation: as-ping 1.6s ease-out 2;
}
@keyframes as-ping { to { transform: scale(1.6); opacity: 0; } }

/* Tek seferlik davet baloncuğu */
.as-nudge {
  position: fixed; right: 20px; bottom: 92px; z-index: 70; width: 300px;
  padding: 16px; border-radius: 18px;
  background: rgba(18, 20, 24, .95); color: #fff; border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .6);
  animation: as-in .45s cubic-bezier(.2, .8, .2, 1) both;
}
.as-nudge::after {
  content: ""; position: absolute; right: 22px; bottom: -8px; width: 14px; height: 14px;
  background: rgb(18, 20, 24);
  border-right: 1px solid rgba(255, 255, 255, .12); border-bottom: 1px solid rgba(255, 255, 255, .12);
  transform: rotate(45deg);
}
.as-nudge[hidden], .as-panel[hidden] { display: none; }
.as-nudge.is-leaving { animation: as-out .3s both; }
.as-nudge p { padding-right: 26px; font-size: .88rem; color: var(--gray); }
.as-nudge strong { display: block; margin-bottom: 2px; font-size: .95rem; color: #fff; }
.as-nudge-cta {
  margin-top: 12px; padding: .5rem 1.05rem; border: 0; border-radius: 999px;
  background: var(--orange); color: var(--night); font-weight: 700; font-size: .85rem;
}
.as-nudge-cta:hover { background: var(--orange-hover); }
.as-nudge-close {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .08); color: #fff;
}
.as-nudge-close:hover { background: rgba(255, 255, 255, .16); }
.as-nudge-close .icon { width: 14px; height: 14px; }

/* Sohbet paneli */
.as-panel {
  position: fixed; right: 20px; bottom: 92px; z-index: 70;
  width: 380px; height: min(600px, calc(100dvh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; border: 1px solid rgba(255, 255, 255, .1);
  background: #111317; color: #fff;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  transform-origin: bottom right;
  animation: as-in .35s cubic-bezier(.2, .8, .2, 1) both;
}
.as-panel:focus { outline: none; }
@keyframes as-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes as-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

.as-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 12px 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: radial-gradient(320px circle at 0% 0%, rgba(255, 106, 0, .22), transparent 70%);
}
.as-avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--orange); color: var(--night);
}
.as-avatar .icon { width: 22px; height: 22px; }
.as-head-text { flex: 1; min-width: 0; }
.as-head h2 { font-size: 1rem; letter-spacing: -.01em; line-height: 1.3; }
.as-head p { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--gray); }
.as-head p::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; }
.as-icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--gray);
}
.as-icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.as-icon-btn .icon { width: 18px; height: 18px; }

.as-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 16px 8px; scrollbar-width: thin; scrollbar-color: #2A2E34 transparent;
}
.as-msg {
  max-width: 86%; padding: .65rem .9rem; border-radius: 16px;
  font-size: .9rem; line-height: 1.5; animation: as-msg .3s ease both;
}
.as-msg.bot { align-self: flex-start; background: #1E2126; color: #E4E6E9; border-bottom-left-radius: 6px; }
.as-msg.user { align-self: flex-end; background: var(--orange); color: var(--night); font-weight: 600; border-bottom-right-radius: 6px; }
.as-msg strong { display: block; margin-bottom: 2px; color: #fff; }
.as-msg ul { display: grid; gap: 4px; margin-top: 6px; }
.as-msg li { position: relative; padding-left: 14px; }
.as-msg li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }

.as-typing {
  align-self: flex-start; display: flex; gap: 4px;
  padding: .8rem .9rem; border-radius: 16px; border-bottom-left-radius: 6px; background: #1E2126;
}
.as-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--gray); animation: as-dot 1s infinite; }
.as-typing i:nth-child(2) { animation-delay: .15s; }
.as-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes as-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes as-msg { from { opacity: 0; transform: translateY(6px); } }

.as-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 14px; }
.as-options:empty { display: none; }
.as-opt {
  padding: .55rem .9rem; border-radius: 999px;
  border: 1px solid rgba(255, 106, 0, .5); background: rgba(255, 106, 0, .08);
  color: #FFD9BF; font-weight: 600; font-size: .85rem; line-height: 1.3; text-align: left; text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s;
  animation: as-msg .3s ease both;
}
.as-opt:hover { background: var(--orange); border-color: var(--orange); color: var(--night); }
.as-opt.primary { background: var(--orange); border-color: var(--orange); color: var(--night); }
.as-opt.primary:hover { background: var(--orange-hover); }
.as-opt.subtle { background: transparent; border-color: rgba(255, 255, 255, .15); color: var(--gray); }
.as-opt.subtle:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .3); color: #fff; }

.as-foot {
  padding: 8px 16px 12px; border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: .72rem; color: #6E747C; text-align: center;
}

@media (max-width: 600px) {
  .as-launcher { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .as-launcher[aria-expanded="true"] { opacity: 0; pointer-events: none; }
  .as-panel { left: 8px; right: 8px; bottom: 8px; width: auto; height: min(80dvh, 620px); }
}

@media (prefers-reduced-motion: reduce) {
  .as-panel, .as-nudge, .as-msg, .as-opt, .as-typing i, .as-launcher.has-ping::after { animation: none; }
}
