/* =========================================================
   Haliç Çevre – ai/assets/ai.css  (v5 Premium)
   AI Asistan — Ürün kalitesinde, glassmorphism panel
   ========================================================= */

/* ── Trigger Button ── */
.ai-widget {
  position: fixed;
  bottom: 1.75rem; right: 1.75rem;
  z-index: 1000;
  font-family: var(--font-family);
}

.ai-trigger {
  position: relative;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0B5EA8 0%, #17A65B 100%);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 4px 20px rgba(11,94,168,.38), 0 1px 4px rgba(11,94,168,.22);
  transition: transform .3s var(--ease-spring), box-shadow .28s ease;
  z-index: 1001; outline: none;
}
.ai-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 32px rgba(11,94,168,.48);
}

@keyframes ai-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.ai-trigger:not(.is-open) {
  animation: ai-float 3s ease-in-out 3s infinite;
}
.ai-trigger.is-open {
  animation: none;
  background: linear-gradient(135deg, #c82020, #e03333);
}

.ai-trigger__icon { display: flex; align-items: center; justify-content: center; transition: opacity .2s ease, transform .28s ease; }
.ai-trigger__icon svg { width: 26px; height: 26px; }
.ai-trigger__icon--close { position: absolute; opacity: 0; transform: rotate(-80deg) scale(.5); }
.ai-trigger__icon--open  { opacity: 1; transform: rotate(0) scale(1); }
.ai-trigger.is-open .ai-trigger__icon--open  { opacity: 0; transform: rotate(80deg) scale(.5); }
.ai-trigger.is-open .ai-trigger__icon--close { opacity: 1; transform: rotate(0) scale(1); }

/* Pulse halkası */
.ai-trigger__pulse {
  position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid rgba(11,94,168,.35);
  animation: ai-pulse 2.2s ease-out infinite;
}
@keyframes ai-pulse {
  0%   { transform: scale(1); opacity: .6; }
  100% { transform: scale(1.55); opacity: 0; }
}
.ai-trigger.is-open .ai-trigger__pulse { display: none; }

/* ── Panel — Premium glassmorphism ── */
.ai-panel {
  position: absolute;
  bottom: 72px; right: 0;
  width: 376px; max-height: 588px; min-height: 480px;
  /* Koyu premium panel */
  background: rgba(10,18,35,.88);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  box-shadow:
    0 24px 80px rgba(0,0,0,.45),
    0 4px 16px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.07);
  display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.88) translateY(16px);
  opacity: 0; pointer-events: none;
  transition: transform .36s var(--ease-spring), opacity .24s ease;
}
.ai-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: all;
}

/* ── Panel Header ── */
.ai-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.125rem .875rem;
  background: linear-gradient(135deg, rgba(11,74,168,.8) 0%, rgba(15,120,75,.6) 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}
.ai-panel__header-brand { display: flex; align-items: center; gap: .75rem; }
.ai-panel__avatar {
  position: relative;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0;
}
.ai-panel__avatar svg { width: 18px; height: 18px; }
.ai-panel__status-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid rgba(10,18,35,.9);
}
@keyframes status-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50%     { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}
.ai-panel__status-dot { animation: status-pulse 2s ease-in-out infinite; }

.ai-panel__title   { font-size: .9375rem; font-weight: 600; line-height: 1.2; color: #fff; letter-spacing: -.01em; }
.ai-panel__subtitle{ font-size: .73rem; color: rgba(255,255,255,.62); margin-top: .1rem; }
.ai-panel__close {
  background: rgba(255,255,255,.1); border: none; cursor: pointer;
  color: rgba(255,255,255,.8); width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease; flex-shrink: 0;
}
.ai-panel__close:hover { background: rgba(255,255,255,.22); color: #fff; }
.ai-panel__close svg { width: 15px; height: 15px; }

/* ── Chat Body ── */
.ai-panel__body {
  flex: 1; overflow-y: auto;
  padding: 1.125rem;
  display: flex; flex-direction: column; gap: .875rem;
  scroll-behavior: smooth;
}
.ai-panel__body::-webkit-scrollbar { width: 4px; }
.ai-panel__body::-webkit-scrollbar-track { background: transparent; }
.ai-panel__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Mesajlar */
.ai-msg { display: flex; gap: .6rem; align-items: flex-end; }
.ai-msg--user { flex-direction: row-reverse; }

.ai-msg__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: rgba(255,255,255,.6);
}
.ai-msg__avatar svg { width: 14px; height: 14px; }

.ai-msg__bubble {
  max-width: 76%;
  padding: .6rem .9rem;
  border-radius: 14px;
  font-size: .855rem; line-height: 1.58;
  animation: bubble-in .3s var(--ease-spring);
}
@keyframes bubble-in {
  from { opacity: 0; transform: scale(.88) translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.ai-msg--bot  .ai-msg__bubble {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.88);
  border-bottom-left-radius: 3px;
}
.ai-msg--user .ai-msg__bubble {
  background: linear-gradient(135deg, #0B5EA8, #0a4f8f);
  color: #fff; border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(11,94,168,.3);
}

/* Yazıyor */
.ai-typing {
  display: flex; gap: 4px; align-items: center;
  padding: .5rem .875rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; border-bottom-left-radius: 3px;
  width: fit-content;
}
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.45);
  animation: typing-dot 1.3s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes typing-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Chips ── */
.ai-panel__chips {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .75rem 1.125rem;
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  background: rgba(0,0,0,.15);
}
.ai-chip {
  font-size: .765rem; font-weight: 500; padding: .3rem .8rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.72); cursor: pointer;
  font-family: var(--font-family);
  transition: all .2s ease; white-space: nowrap;
}
.ai-chip:hover {
  background: rgba(11,94,168,.5);
  color: #fff; border-color: rgba(11,94,168,.6);
  transform: translateY(-1px);
}

/* WhatsApp chip — chip gibi aynı boyut ama yeşil */
.ai-chip--whatsapp {
  display: inline-flex; align-items: center; gap: .38rem;
  text-decoration: none;
  color: rgba(255,255,255,.85);
  background: rgba(37,211,102,.12);
  border-color: rgba(37,211,102,.3);
}
.ai-chip--whatsapp svg { width: 14px; height: 14px; flex-shrink: 0; }
.ai-chip--whatsapp:hover {
  background: rgba(37,211,102,.28);
  color: #fff;
  border-color: rgba(37,211,102,.55);
  transform: translateY(-1px);
}

/* ── Input Footer ── */
.ai-panel__footer {
  padding: .75rem 1.125rem .875rem;
  flex-shrink: 0;
  background: rgba(0,0,0,.1);
  border-top: 1px solid rgba(255,255,255,.05);
}
.ai-input-wrap {
  display: flex; gap: .4rem; align-items: center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9999px;
  padding: .3rem .3rem .3rem .875rem;
  transition: border-color .2s ease;
}
.ai-input-wrap:focus-within { border-color: rgba(11,94,168,.6); background: rgba(255,255,255,.1); }
.ai-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: .875rem; font-family: var(--font-family);
  color: rgba(255,255,255,.88);
}
.ai-input::placeholder { color: rgba(255,255,255,.3); }
.ai-send {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--color-primary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
  transition: background .2s ease, transform .2s ease;
  box-shadow: 0 2px 8px rgba(11,94,168,.35);
}
.ai-send:hover { background: #0a4f8f; transform: scale(1.08); }
.ai-send:disabled { background: rgba(255,255,255,.15); cursor: not-allowed; transform: none; box-shadow: none; }
.ai-send svg { width: 15px; height: 15px; }

.ai-panel__disclaimer {
  font-size: .66rem; color: rgba(255,255,255,.25);
  text-align: center; margin-top: .5rem;
}

/* Mobil */
@media (max-width: 480px) {
  .ai-widget { bottom: 1rem; right: 1rem; }
  .ai-panel { width: calc(100vw - 2rem); right: 0; max-height: 70vh; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ai-trigger { animation: none !important; }
  .ai-trigger__pulse { animation: none !important; display: none; }
  .ai-panel { transition: opacity .15s ease !important; transform: none !important; }
  .ai-msg__bubble { animation: none !important; }
  .ai-typing span { animation: none !important; }
}

