/* Metrik Dijital — Chatbot Widget */
.mdchat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform .25s ease, filter .25s ease;
  filter: drop-shadow(0 8px 20px rgba(168,85,247,.5));
}
.mdchat-launcher:hover { transform: translateY(-3px) scale(1.05); filter: drop-shadow(0 12px 28px rgba(168,85,247,.7)); }
.mdchat-launcher svg { width: 26px; height: 26px; color: #fff; }
.mdchat-launcher .mdchat-dot {
  position: absolute; top: 4px; right: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid #000;
}
.mdchat-launcher-mascot {
  width: 42px;
  height: 42px;
  display: block;
  transform-origin: 50% 50%;
}
.mdchat-launcher.mdchat-spin-away .mdchat-launcher-mascot {
  animation: mdchat-spin-away 1.1s cubic-bezier(.55,0,.85,.35) forwards;
}
@keyframes mdchat-spin-away {
  0%   { transform: rotate(0deg) scale(1); opacity: 1; }
  60%  { transform: rotate(720deg) scale(0.55); opacity: 1; }
  100% { transform: rotate(1080deg) scale(0.1); opacity: 0; }
}

/* Kargaya dönüşüp uçarak uzaklaşma efekti — pencerenin üstüne kadar uçar */
.mdchat-flying-crow {
  position: fixed;
  bottom: 34px;
  right: 40px;
  width: 84px;
  height: auto;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
}
.mdchat-flying-crow.mdchat-fly {
  animation: mdchat-crow-fly 2s ease-in-out forwards;
}
.mdchat-flying-crow .mdchat-crow-flap {
  animation: mdchat-flap .2s ease-in-out infinite;
  transform-origin: 50% 50%;
}
@keyframes mdchat-crow-fly {
  0%   { opacity: 0; transform: translate(10px, 10px) scale(0.7) rotate(-8deg); }
  10%  { opacity: 1; }
  40%  { transform: translate(-60px, -260px) scale(1) rotate(6deg); }
  75%  { transform: translate(-40px, -460px) scale(0.95) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-20px, -560px) scale(0.9) rotate(0deg); }
}
@keyframes mdchat-flap {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.72); }
}

/* Sohbet penceresinin üstüne konan maskot — window'un dışında, bağımsız sabit konumlu */
.mdchat-perched-mascot {
  position: fixed;
  width: 58px;
  height: 58px;
  opacity: 0;
  transform: translateY(-30px) scale(0.3) rotate(-15deg);
  pointer-events: none;
  z-index: 10001;
}
.mdchat-perched-mascot.mdchat-land {
  animation: mdchat-land .6s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes mdchat-land {
  0%   { opacity: 0; transform: translateY(-40px) scale(0.3) rotate(-15deg); }
  65%  { opacity: 1; transform: translateY(4px) scale(1.12) rotate(4deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.mdchat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: 0 20px 60px -12px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.mdchat-window.mdchat-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mdchat-header {
  background: var(--grad2);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mdchat-header-info { display: flex; align-items: center; gap: 10px; }
.mdchat-header-title { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: #fff; }
.mdchat-header-sub { font-size: 12px; color: rgba(255,255,255,.85); }
.mdchat-close {
  background: rgba(255,255,255,.15);
  border: none; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease;
}
.mdchat-close:hover { background: rgba(255,255,255,.28); }

.mdchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mdchat-msg { max-width: 84%; font-size: 13.5px; line-height: 1.5; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.mdchat-msg.bot { align-self: flex-start; background: rgba(255,255,255,.06); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.mdchat-msg.user { align-self: flex-end; background: var(--grad2); color: #fff; border-bottom-right-radius: 4px; }

.mdchat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 13px; }
.mdchat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted2); animation: mdchat-bounce 1.2s infinite ease-in-out; }
.mdchat-typing span:nth-child(2) { animation-delay: .15s; }
.mdchat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mdchat-bounce { 0%,60%,100%{ transform: translateY(0); opacity:.5 } 30%{ transform: translateY(-5px); opacity:1 } }

.mdchat-inputrow {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.mdchat-inputrow textarea {
  flex: 1;
  resize: none;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  max-height: 80px;
  outline: none;
}
.mdchat-inputrow textarea:focus { border-color: var(--c1); }
.mdchat-send {
  background: var(--grad2);
  border: none;
  border-radius: 12px;
  width: 42px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .2s ease;
}
.mdchat-send:hover { filter: brightness(1.1); }
.mdchat-send:disabled { opacity: .5; cursor: not-allowed; }
.mdchat-send svg { width: 18px; height: 18px; color: #fff; }

@media (max-width: 480px) {
  .mdchat-window { right: 16px; bottom: 90px; width: calc(100vw - 32px); }
  .mdchat-launcher { right: 16px; bottom: 16px; }
}
