/* AI Asistan — sayfanin sag alt kosesinde acilip kapanan sohbet penceresi */
:root {
  --chat-gold: #c8a96a;
  --chat-gold-light: #e0c285;
  --chat-ink: #0a0a0f;
  --chat-body-bg: #14151f;
  --chat-bubble-asst: #1f2030;
  --chat-bubble-asst-text: #f0e8d6;
}

#chatWidget {
  position: fixed;
  right: 110px;        /* float-stack (telefon/whatsapp) ile cakismasin */
  bottom: 30px;
  z-index: 9500;
  font-family: 'Inter Tight', system-ui, sans-serif;
}

@media (max-width: 720px) {
  #chatWidget { right: 12px; bottom: 96px; } /* mobilde float-stack uzerinde */
}

/* ==================== TOGGLE BUTTON (ROBOT LOGO) ==================== */
.chat-toggle {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd690 0%, var(--chat-gold) 55%, #9a7a44 100%);
  color: #fff;
  border: none;
  box-shadow: 0 14px 32px rgba(200,169,106,0.45), inset 0 -4px 10px rgba(0,0,0,0.18);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s var(--ease, cubic-bezier(.4,0,.2,1)), box-shadow .25s ease;
  position: relative;
  overflow: visible;
  animation: chatBob 4s ease-in-out infinite;
}
.chat-toggle:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 18px 40px rgba(200,169,106,0.55);
}
.chat-toggle .chat-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(200,169,106,0.55);
  animation: chatPulse 2.4s infinite ease-out;
  pointer-events: none;
}
.chat-toggle .chat-pulse:nth-child(2) { animation-delay: 1.2s; }
.chat-toggle .chat-bubble-tip {
  position: absolute;
  top: -42px;
  right: 0;
  background: var(--chat-gold);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 14px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(200,169,106,0.4);
  pointer-events: none;
  animation: chatTipFloat 3s ease-in-out infinite;
}
.chat-toggle .chat-bubble-tip::after {
  content: '';
  position: absolute;
  bottom: -6px; right: 22px;
  width: 12px; height: 12px;
  background: var(--chat-gold);
  transform: rotate(45deg);
  border-radius: 2px;
}
.chat-window.open ~ .chat-toggle .chat-bubble-tip { display: none; }

/* Robot SVG — kulakli, animasyonlu */
.bot-svg { width: 46px; height: 46px; display: block; overflow: visible; }
.bot-svg .bot-antenna-grp { transform-origin: 32px 16px; animation: antennaSway 2.8s ease-in-out infinite; }
.bot-svg .bot-antenna { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.bot-svg .bot-antenna-tip { fill: #fff; filter: drop-shadow(0 0 4px #ffe599); }
.bot-svg .bot-antenna-glow {
  fill: #ffd690;
  opacity: 0.55;
  transform-origin: 32px 5px;
  animation: antennaPulse 1.8s ease-in-out infinite;
}
.bot-svg .bot-headphone-band { stroke: #2a2a36; stroke-width: 3; fill: none; stroke-linecap: round; }
.bot-svg .bot-headphone-cup, .bot-svg .bot-mic { /* handled inline */ }
.bot-svg .bot-eyes { transform-origin: 32px 34px; animation: botBlink 5s infinite; }
.bot-svg .bot-eye-glow { filter: drop-shadow(0 0 3px #7df0ff); }
.bot-svg .bot-eye-shine { animation: shineWobble 3.8s ease-in-out infinite; }
.bot-svg .bot-chest { transform-origin: 32px 58px; animation: chestPulse 2.2s ease-in-out infinite; }
.bot-svg .bot-cheek { animation: cheekFade 4s ease-in-out infinite; }

@keyframes antennaSway {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}
@keyframes antennaPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.5); opacity: 0.85; }
}
@keyframes botBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
  96% { transform: scaleY(1); }
}
@keyframes shineWobble {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0.6px, 0.4px); }
}
@keyframes chestPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 0.95; transform: scale(1.2); }
}
@keyframes cheekFade {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes chatPulse {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes chatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes chatTipFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes antennaSway {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
@keyframes botBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.1); }
  96% { transform: scaleY(1); }
}

/* ==================== CHAT WINDOW ==================== */
.chat-window {
  position: absolute;
  right: 0;
  bottom: 88px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 140px);
  background: var(--chat-body-bg);
  color: var(--chat-bubble-asst-text);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.95) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
  border: 1px solid rgba(200,169,106,0.15);
}
.chat-window.open { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }

@media (max-width: 720px) {
  .chat-window { width: calc(100vw - 24px); height: calc(100vh - 160px); bottom: 84px; }
}

.chat-header {
  background: linear-gradient(180deg, #1f1f2c, #161620);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(200,169,106,0.15);
}
.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd690 0%, var(--chat-gold) 55%, #9a7a44 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 -2px 6px rgba(0,0,0,0.15);
}
.chat-avatar .bot-svg { width: 28px; height: 28px; }
.chat-meta { flex: 1; min-width: 0; }
.chat-meta strong { display: block; font-size: 1rem; line-height: 1.2; color: #fff; }
.chat-meta small { color: rgba(255,255,255,0.55); font-size: 0.78rem; display: flex; align-items: center; gap: 6px; }
.chat-meta small::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: onlineDotPulse 2s ease-in-out infinite;
}
@keyframes onlineDotPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
.chat-close {
  background: rgba(255,255,255,0.06);
  border: none; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.chat-close:hover { background: rgba(255,255,255,0.12); }

/* ==================== BODY / MESSAGES ==================== */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--chat-body-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: rgba(200,169,106,0.3); border-radius: 3px; }

.chat-msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: msgIn .25s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--chat-bubble-asst);
  color: var(--chat-bubble-asst-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(200,169,106,0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-gold), #b9914a);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(200,169,106,0.35);
}
.chat-msg.system {
  align-self: center;
  background: rgba(200,71,71,0.18);
  color: #ff9b9b;
  font-size: 0.82rem;
  border-radius: 10px;
  text-align: center;
  max-width: 92%;
  border: 1px solid rgba(200,71,71,0.25);
}
.chat-msg a { color: var(--chat-gold-light); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.user a { color: #fff; }
.chat-msg strong { color: #fff; }
.chat-msg.user strong { color: #fff; }
.chat-msg code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .85em;
}

/* Asistan baloncugu yaninda kucuk avatar */
.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
  max-width: 90%;
}
.chat-msg-row .mini-bot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd690 0%, var(--chat-gold) 55%, #9a7a44 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.chat-msg-row .mini-bot .bot-svg { width: 18px; height: 18px; }
.chat-msg-row .chat-msg { max-width: 100%; }

/* Typing indicator */
.chat-typing-row {
  display: flex; align-items: flex-end; gap: 8px;
  align-self: flex-start;
}
.chat-typing {
  background: var(--chat-bubble-asst);
  border: 1px solid rgba(200,169,106,0.15);
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: inline-flex;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.chat-typing span {
  width: 7px; height: 7px;
  background: var(--chat-gold-light);
  border-radius: 50%;
  animation: typingDot 1.3s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick buttons */
.chat-quick {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  background: var(--chat-body-bg);
}
.chat-quick button {
  background: rgba(200,169,106,0.1);
  border: 1px solid rgba(200,169,106,0.3);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--chat-gold-light);
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.chat-quick button:hover {
  background: var(--chat-gold);
  color: var(--chat-ink);
  border-color: var(--chat-gold);
  transform: translateY(-1px);
}

/* Input */
.chat-input {
  border-top: 1px solid rgba(200,169,106,0.15);
  background: #1a1b25;
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(200,169,106,0.2);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  outline: none;
  max-height: 110px;
  background: #0f1019;
  color: #f0e8d6;
}
.chat-input textarea::placeholder { color: rgba(240,232,214,0.4); }
.chat-input textarea:focus { border-color: var(--chat-gold); background: #14151f; }
.chat-input button {
  background: linear-gradient(135deg, var(--chat-gold), #b9914a);
  border: none; color: var(--chat-ink);
  width: 42px; height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(200,169,106,0.3);
  transition: transform .15s ease;
}
.chat-input button:hover { transform: scale(1.06); }
.chat-input button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-footer {
  padding: 8px 16px 12px;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(240,232,214,0.4);
  background: #1a1b25;
}
.chat-footer strong { color: var(--chat-gold-light); }

/* ==================== INTAKE FORM (kimlik toplama) ==================== */
.chat-id-btn {
  background: rgba(200,169,106,0.18);
  border: 1px solid rgba(200,169,106,0.35);
  color: var(--chat-gold-light);
  cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 4px;
}
.chat-id-btn:hover { background: rgba(200,169,106,0.32); }

.chat-intake {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  background: var(--chat-body-bg);
  color: var(--chat-bubble-asst-text);
}
.chat-intake .intake-bot {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd690 0%, var(--chat-gold) 55%, #9a7a44 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 22px rgba(200,169,106,0.35);
}
.chat-intake .intake-bot .bot-svg { width: 42px; height: 42px; }
.chat-intake h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.32rem;
  font-weight: 600;
  margin: 0 0 6px;
  text-align: center;
  color: #fff;
}
.chat-intake p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: rgba(240,232,214,0.78);
  margin: 0 0 18px;
  text-align: center;
}
.chat-intake form { display: flex; flex-direction: column; gap: 10px; }
.chat-intake .intake-row { display: flex; gap: 8px; }
.chat-intake .intake-row input { flex: 1; }
.chat-intake input[type="text"],
.chat-intake input[type="tel"],
.chat-intake input[type="email"] {
  padding: 11px 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200,169,106,0.22);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color .18s ease, background .18s ease;
}
.chat-intake input::placeholder { color: rgba(240,232,214,0.42); }
.chat-intake input:focus {
  border-color: var(--chat-gold);
  background: rgba(255,255,255,0.07);
}
.chat-intake .intake-kvkk {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(240,232,214,0.72);
  line-height: 1.45;
  cursor: pointer;
  margin-top: 4px;
}
.chat-intake .intake-kvkk input { margin-top: 2px; accent-color: var(--chat-gold); }
.chat-intake .intake-kvkk a { color: var(--chat-gold-light); text-decoration: underline; }
.chat-intake .intake-error {
  background: rgba(200,71,71,0.18);
  color: #ffb3b3;
  border: 1px solid rgba(200,71,71,0.28);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
}
.chat-intake .intake-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.chat-intake .intake-skip,
.chat-intake .intake-submit {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform .15s ease, box-shadow .18s ease;
}
.chat-intake .intake-skip {
  background: transparent;
  color: rgba(240,232,214,0.7);
  border: 1px solid rgba(240,232,214,0.18);
}
.chat-intake .intake-skip:hover { color: #fff; border-color: rgba(240,232,214,0.32); }
.chat-intake .intake-submit {
  background: linear-gradient(135deg, var(--chat-gold), #b9914a);
  color: #fff;
  box-shadow: 0 6px 14px rgba(200,169,106,0.32);
}
.chat-intake .intake-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(200,169,106,0.45);
}
.chat-intake .intake-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Yazdirma onizlemesinde widget'i tamamen gizle */
@media print {
  #chatWidget,
  #chatWidget * {
    display: none !important;
    visibility: hidden !important;
  }
}
