/* ===== CANLI DESTEK WIDGET ===== */
#canli-destek-btn {
  position: fixed !important;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
  right: calc(28px + env(safe-area-inset-right, 0px)) !important;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #08551f;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(8,85,31,0.4);
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 9999;
  transition: transform 0.2s, background 0.2s;
}
#canli-destek-btn:hover {
  background: #0a6b28;
  transform: scale(1.08);
}
#canli-destek-btn .chat-close-icon { display: none; }
#canli-destek-btn.open .chat-open-icon  { display: none; }
#canli-destek-btn.open .chat-close-icon { display: block; }

#canli-destek-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53e3e;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#canli-destek-pencere {
  position: fixed !important;
  bottom: 100px !important;
  right: 28px !important;
  top: auto !important;
  left: auto !important;
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9998;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
}
#canli-destek-pencere.acik {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

#cd-header {
  background: #08551f;
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#cd-header .cd-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
#cd-header .cd-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
#cd-header .cd-info span {
  font-size: 12px;
  opacity: 0.85;
}
.cd-online-dot {
  width: 9px;
  height: 9px;
  background: #68d391;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#cd-mesajlar {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fa;
}
.cd-mesaj {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
}
.cd-mesaj.destek {
  background: white;
  color: #222;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.cd-mesaj.kullanici {
  background: #08551f;
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.cd-mesaj-zaman {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
  text-align: right;
}

.cd-mesaj.yaziyor {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 11px 14px;
}
.cd-mesaj.yaziyor span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a0aec0;
  animation: cdTypingBounce 1.2s infinite ease-in-out;
}
.cd-mesaj.yaziyor span:nth-child(2) { animation-delay: 0.2s; }
.cd-mesaj.yaziyor span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cdTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.cd-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cd-quick-replies button {
  background: #eef6f0;
  border: 1px solid #cfe8d8;
  color: #145c2c;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.cd-quick-replies button:hover {
  background: #08551f;
  border-color: #08551f;
  color: #fff;
}
.cd-quick-replies button:disabled {
  opacity: 0.5;
  cursor: default;
}

#cd-alt {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}
#cd-input {
  flex: 1;
  border: 1px solid #cbd5e0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13.5px;
  outline: none;
  font-family: 'Segoe UI', sans-serif;
  transition: border-color 0.2s;
}
#cd-input:focus { border-color: #08551f; }
#cd-gonder {
  background: #08551f;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s;
}
#cd-gonder:hover { background: #0a6b28; }

/* Mobil uyumu */
@media (max-width: 480px) {
  #canli-destek-btn {
    width: 52px;
    height: 52px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
    font-size: 22px;
  }
  #canli-destek-pencere {
    width: calc(100vw - 24px);
    right: 12px !important;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: min(72vh, 520px);
  }
  #cd-mesajlar { max-height: 44vh; }
}