/* Ağabeyoğlu Grup AI Chatbot Widget - 18 Mayıs 2026 */
:root {
  --ag-primary: #0b0b0e;
  --ag-accent: #e01425;
  --ag-bg: #ffffff;
  --ag-ink: #0b0b0e;
  --ag-muted: #6b6b75;
  --ag-line: #e6e6ea;
  --ag-bubble-user: #0b0b0e;
  --ag-bubble-bot: #f3f3f5;
  --ag-wa: #25D366;
}

#ag-chat-toggle {
  position: fixed; right: 22px; bottom: 22px; z-index: 9998;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #1a1a1f 0%, #0b0b0e 100%);
  color: #fff; border: none; cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
#ag-chat-toggle:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 36px -8px rgba(224,20,37,.4); }
#ag-chat-toggle .ag-icon-chat { display: block; }
#ag-chat-toggle .ag-icon-close { display: none; }
#ag-chat-toggle.open .ag-icon-chat { display: none; }
#ag-chat-toggle.open .ag-icon-close { display: block; }
#ag-chat-toggle .ag-dot {
  position: absolute; top: 4px; right: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ag-accent); border: 2px solid #0b0b0e;
  animation: agPulse 1.6s infinite;
}
@keyframes agPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: .7; }
  100% { transform: scale(1); opacity: 1; }
}

#ag-chat-panel {
  position: fixed; right: 22px; bottom: 96px; z-index: 9999;
  width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 130px);
  background: var(--ag-bg); border-radius: 18px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,.35);
  display: none; flex-direction: column; overflow: hidden;
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  color: var(--ag-ink);
  border: 1px solid var(--ag-line);
}
#ag-chat-panel.open { display: flex; }
#ag-chat-panel * { box-sizing: border-box; }

.ag-header {
  background: linear-gradient(135deg, #1a1a1f 0%, #0b0b0e 100%);
  color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.ag-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #fff 0%, var(--ag-accent) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #0b0b0e; flex-shrink: 0;
  letter-spacing: -0.02em;
}
.ag-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.ag-subtitle { font-size: 12px; color: #b9b9bf; margin-top: 2px; }
.ag-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #25D366;
  display: inline-block; margin-right: 6px;
}
.ag-header-actions {
  margin-left: auto; display: flex; gap: 4px; align-items: center;
}
.ag-iconbtn {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.08); border: none; cursor: pointer;
  color: #b9b9bf; display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.ag-iconbtn:hover { background: rgba(255,255,255,.16); color: #fff; }
.ag-iconbtn.danger:hover { background: rgba(224,20,37,.25); color: var(--ag-accent); }

.ag-messages {
  flex: 1; padding: 18px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
}
.ag-messages::-webkit-scrollbar { width: 6px; }
.ag-messages::-webkit-scrollbar-thumb { background: #d6d6da; border-radius: 3px; }

.ag-msg {
  max-width: 84%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}
.ag-msg.bot {
  background: var(--ag-bubble-bot); color: var(--ag-ink);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.ag-msg.user {
  background: var(--ag-bubble-user); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.ag-msg b, .ag-msg strong { font-weight: 700; }
.ag-msg ul { margin: 6px 0; padding-left: 18px; }
.ag-msg li { margin: 2px 0; }

.ag-typing { color: var(--ag-muted); font-size: 13px; padding: 8px 14px; }
.ag-typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ag-muted); margin: 0 2px; animation: agBlink 1.4s infinite; }
.ag-typing span:nth-child(2) { animation-delay: .2s; }
.ag-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes agBlink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.ag-input-row {
  padding: 12px; border-top: 1px solid var(--ag-line); background: #fff;
  display: flex; gap: 8px; align-items: flex-end;
}
.ag-input-row textarea {
  flex: 1; border: 1px solid var(--ag-line); border-radius: 14px;
  padding: 10px 14px; font-family: inherit; font-size: 16px; color: var(--ag-ink);
  resize: none; max-height: 100px; min-height: 42px; outline: none;
  transition: border-color .15s ease;
  -webkit-text-size-adjust: 100%;
}
.ag-input-row textarea:focus { border-color: var(--ag-accent); }
@media (max-width: 640px) {
  .ag-input-row textarea, .ag-input-row input { font-size: 16px !important; }
}
.ag-input-row .ag-send {
  background: var(--ag-primary); color: #fff; border: none; border-radius: 50%;
  width: 42px; height: 42px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.ag-input-row .ag-send:hover { background: var(--ag-accent); }
.ag-input-row .ag-send:disabled { background: #c5c5cd; cursor: not-allowed; }

.ag-footer-mini {
  text-align: center; font-size: 11px; color: var(--ag-muted);
  padding: 8px 12px 12px; display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
}
.ag-wa-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ag-wa); color: #fff; text-decoration: none;
  font-size: 11px; font-weight: 600;
  transition: opacity .15s ease, transform .15s ease;
}
.ag-wa-pill:hover { opacity: .9; transform: translateY(-1px); }

/* Mobil fullscreen */
@media (max-width: 640px) {
  #ag-chat-panel {
    position: fixed !important;
    top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
    width: 100% !important; max-width: 100% !important;
    height: 100% !important; max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
  }
  #ag-chat-toggle { right: 14px; bottom: 14px; }
  .ag-messages { padding: 16px; }
  .ag-msg { max-width: 88%; font-size: 14.5px; }
  .ag-header { padding: 16px 18px; }
  .ag-title { font-size: 16px; }
}
body.ag-locked { overflow: hidden; }
