/* AI Canlı Destek — sol/sağ alt floating */
.cb-ai-destek {
  position: fixed;
  /* scrollToTop (~bottom:15px, h:50px) ile çakışmasın — onun üstünde dursun */
  bottom: 88px;
  z-index: 99990;
  font-family: 'Manrope', system-ui, sans-serif;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 8px;
}
.cb-ai-destek.cb-ai-left { left: 18px; right: auto; }
.cb-ai-destek.cb-ai-right { right: 18px; left: auto; align-items: flex-end; }

.cb-ai-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(145deg, #1A2340 0%, #25334F 45%, #CE1414 100%);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(16, 22, 42, 0.3);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cb-ai-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 30px rgba(16, 22, 42, 0.36);
}
.cb-ai-robot {
  display: inline-flex;
  line-height: 0;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}
.cb-ai-robot svg { width: 26px; height: 26px; }
.cb-ai-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cb-ai-mini-robot {
  display: inline-flex;
  line-height: 0;
  flex: 0 0 auto;
}
.cb-ai-mini-robot svg { width: 22px; height: 22px; }
.cb-ai-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(206, 20, 20, 0.45);
  animation: cbAiPulse 2s infinite;
  pointer-events: none;
}
@keyframes cbAiPulse {
  0% { transform: scale(0.92); opacity: 0.9; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { opacity: 0; }
}

.cb-ai-panel {
  width: min(300px, calc(100vw - 24px));
  height: min(420px, calc(100vh - 96px));
  max-height: calc(100vh - 96px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(16, 22, 42, 0.2);
  border: 1px solid rgba(26, 35, 64, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}
/* Bootstrap [hidden] override: kapalıyken panel/metin kutusu görünmesin */
.cb-ai-panel[hidden],
.cb-ai-destek.is-closed .cb-ai-panel {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.cb-ai-destek.cb-ai-left .cb-ai-panel { transform-origin: bottom left; }
.cb-ai-destek.cb-ai-right .cb-ai-panel { transform-origin: bottom right; }

.cb-ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 9px;
  background: linear-gradient(120deg, #1A2340, #2a3658 55%, #CE1414);
  color: #fff;
  flex: 0 0 auto;
}
.cb-ai-panel-head strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-ai-panel-head small {
  display: block;
  opacity: 0.85;
  font-size: 10px;
  margin-top: 1px;
}
.cb-ai-close {
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.cb-ai-chatwrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cb-ai-chatwrap[hidden] { display: none !important; }

.cb-ai-lead {
  padding: 10px;
  background: #F5F7FB;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
}
.cb-ai-lead[hidden] { display: none !important; }
.cb-ai-lead-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #1A2340;
  font-weight: 650;
}
.cb-ai-lead-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.cb-ai-lead-grid input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(26, 35, 64, 0.12);
  border-radius: 8px;
  padding: 8px 9px;
  font-size: 12px;
  outline: none;
  background: #fff;
  min-width: 0;
}
.cb-ai-lead-grid input:nth-child(3),
.cb-ai-lead-grid input:nth-child(4) {
  grid-column: 1 / -1;
}
.cb-ai-lead-grid input:focus { border-color: rgba(206, 20, 20, 0.45); }
.cb-ai-lead-btn {
  border: 0;
  border-radius: 8px;
  background: #CE1414;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 9px 12px;
  cursor: pointer;
  margin-top: auto;
}
.cb-ai-lead-btn:hover { filter: brightness(1.05); }

.cb-ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  background: #F5F7FB;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cb-ai-msg {
  max-width: 94%;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #1A2340;
  word-break: break-word;
}
.cb-ai-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(26, 35, 64, 0.06);
}
.cb-ai-msg.user {
  align-self: flex-end;
  background: #1A2340;
  color: #fff;
}
.cb-ai-msg .cb-ai-links {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cb-ai-msg .cb-ai-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #CE1414 !important;
  text-decoration: none !important;
  background: rgba(206, 20, 20, 0.06);
  padding: 5px 7px;
  border-radius: 7px;
}
.cb-ai-msg .cb-ai-links a:hover { background: rgba(206, 20, 20, 0.12); }
.cb-ai-typing { opacity: 0.7; font-style: italic; }

.cb-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 8px;
  border-top: 1px solid rgba(26, 35, 64, 0.06);
  background: #fff;
  flex: 0 0 auto;
  max-height: 72px;
  overflow: auto;
}
.cb-ai-qchip {
  border: 1px solid rgba(26, 35, 64, 0.1);
  background: #F4F6FB;
  color: #1A2340;
  font-size: 10px;
  font-weight: 650;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
}
.cb-ai-qchip:hover { border-color: rgba(206,20,20,0.35); color: #CE1414; }

.cb-ai-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(26, 35, 64, 0.06);
  background: #fff;
  flex: 0 0 auto;
}
.cb-ai-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(26, 35, 64, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
}
.cb-ai-form input:focus { border-color: rgba(206, 20, 20, 0.45); }
.cb-ai-form button {
  width: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 8px;
  background: #CE1414;
  color: #fff;
  cursor: pointer;
}
.cb-ai-form button:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 575px) {
  .cb-ai-destek { bottom: 84px; }
  .cb-ai-destek.cb-ai-left { left: 10px; right: auto; }
  .cb-ai-destek.cb-ai-right { right: 10px; left: auto; }
  .cb-ai-panel {
    width: min(292px, calc(100vw - 20px));
    height: min(68vh, 400px);
  }
}
