/* =====================================================================
 *  Formal Alüminyum Chatbot — UI
 *  Responsive: masaüstü 380x560 sağ alt, mobil fullscreen
 *  Tema: --alu-primary (varsayılan #0066cc, ayardan değiştirilebilir)
 *  ===================================================================== */

#alu-chat-root {
  --alu-primary: #0066cc;
  --alu-primary-dark: #0052a3;
  --alu-bg: #ffffff;
  --alu-text: #1a1a1a;
  --alu-text-soft: #6b7280;
  --alu-border: #e5e7eb;
  --alu-bubble-user: #0066cc;
  --alu-bubble-bot: #f3f4f6;
  --alu-shadow: 0 12px 40px rgba(0,0,0,0.18);
  --alu-radius: 16px;
  --alu-z: 99998;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  color: var(--alu-text);
  -webkit-font-smoothing: antialiased;
}

#alu-chat-root *,
#alu-chat-root *::before,
#alu-chat-root *::after { box-sizing: border-box; }

/* ===== PANEL ===== */
.alu-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 110px; /* robot için yer */
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--alu-bg);
  border-radius: var(--alu-radius);
  box-shadow: var(--alu-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--alu-z);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity .25s ease, transform .25s ease;
}
#alu-chat-root.alu-chat-open .alu-chat-panel {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ===== HEADER ===== */
.alu-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--alu-primary);
  color: #fff;
  flex-shrink: 0;
}
.alu-chat-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.alu-chat-avatar::before { content: '🤖'; }
.alu-chat-title { flex: 1; min-width: 0; }
.alu-chat-bot-name { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; }
.alu-chat-status   { display: block; font-size: 12px; opacity: 0.85; line-height: 1.2; margin-top: 2px; }
.alu-chat-status::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #4ade80; margin-right: 6px;
  vertical-align: 1px;
  animation: alu-pulse 2s infinite;
}
@keyframes alu-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.alu-chat-close-btn {
  background: transparent; border: 0; color: #fff;
  width: 30px; height: 30px;
  cursor: pointer; padding: 0;
  border-radius: 6px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.alu-chat-close-btn:hover { background: rgba(255,255,255,0.18); }

/* ===== BODY ===== */
.alu-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* KVKK */
.alu-chat-kvkk {
  padding: 24px 20px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  background: #f9fafb;
}
.alu-chat-kvkk p { margin: 0 0 16px; color: var(--alu-text-soft); }
.alu-chat-kvkk a { color: var(--alu-primary); text-decoration: underline; }
.alu-chat-kvkk-btn {
  background: var(--alu-primary);
  color: #fff;
  border: 0;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.alu-chat-kvkk-btn:hover { background: var(--alu-primary-dark); }

/* MESAJLAR */
.alu-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.alu-chat-messages::-webkit-scrollbar { width: 6px; }
.alu-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.alu-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: alu-slide-in .25s ease;
}
@keyframes alu-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alu-msg-bot {
  align-self: flex-start;
  background: var(--alu-bubble-bot);
  color: var(--alu-text);
  border-bottom-left-radius: 4px;
}
.alu-msg-user {
  align-self: flex-end;
  background: var(--alu-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.alu-msg-system {
  align-self: center;
  font-size: 12px;
  color: var(--alu-text-soft);
  background: transparent;
  text-align: center;
}
.alu-msg a {
  color: inherit;
  text-decoration: underline;
  word-break: break-all;
}
.alu-msg-user a { color: #fff; }

/* TYPING */
.alu-typing {
  align-self: flex-start;
  background: var(--alu-bubble-bot);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: none;
}
.alu-typing.show { display: flex; gap: 4px; }
.alu-typing span {
  width: 7px; height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: alu-bounce 1.4s infinite ease-in-out;
}
.alu-typing span:nth-child(2) { animation-delay: .15s; }
.alu-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes alu-bounce {
  0%,80%,100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* QUICK REPLIES */
.alu-chat-quick {
  padding: 8px 16px 0;
  display: flex;
  margin-bottom:10px;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.alu-chat-quick-btn {
  border: 1px solid var(--alu-primary);
  color: var(--alu-primary);
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.alu-chat-quick-btn:hover { background: var(--alu-primary); color: #fff; }

.alu-chat-btn {
  display: inline-block;
  background: var(--alu-primary);
  color: #fff !important;
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s;
  margin-top: 5px;
}
.alu-chat-btn:hover { background: var(--alu-primary-dark); }

/* INPUT */
.alu-chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--alu-border);
  flex-shrink: 0;
  background: #fff;
}
.alu-chat-input textarea {
  flex: 1;
  border: 1px solid var(--alu-border);
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  outline: none;
  transition: border-color .15s;
  line-height: 1.4;
  overflow-y: hidden;
}
.alu-chat-input textarea::-webkit-scrollbar { display: none; }
.alu-chat-input textarea { -ms-overflow-style: none; scrollbar-width: none; }
.alu-chat-input textarea:focus { border-color: var(--alu-primary); }
.alu-chat-input button {
  background: var(--alu-primary);
  color: #fff;
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background .15s;
}
.alu-chat-input button:hover:not(:disabled) { background: var(--alu-primary-dark); }
.alu-chat-input button:disabled { background: #9ca3af; cursor: not-allowed; }

/* FOOTER */
.alu-chat-foot {
  text-align: center;
  font-size: 11px;
  color: var(--alu-text-soft);
  padding: 6px 0 10px;
  background: #fff;
  flex-shrink: 0;
}

/* RATE LIMIT / ERROR BAR */
.alu-chat-error {
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  padding: 8px 16px;
  text-align: center;
  border-top: 1px solid #fecaca;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .alu-chat-panel {
    right: 0; left: 0; bottom: 0; top: 0;
    width: 100%; height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  #alu-chat-root.alu-chat-min .alu-chat-panel {
    top: auto; height: 60px; max-height: 60px;
    border-radius: var(--alu-radius) var(--alu-radius) 0 0;
  }
}

@media (max-width: 360px) {
  .alu-chat-input textarea { font-size: 13px; padding: 8px 12px; }
  .alu-msg { font-size: 13px; padding: 8px 12px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .alu-chat-panel, .alu-msg, .alu-chat-status::before, .alu-typing span {
    animation: none !important;
    transition: none !important;
  }
}
