/* ============================================================
   Leodent AI Chat — Eklentiler/ai-chat-widget portu (vanilla CSS)
   Glass UI · neutral palette · rounded-3xl · backdrop blur
   Pattern: Sparkles brand · pulse dot · typewriter · file upload
   ============================================================ */

:root {
  --leo-chat-radius-card: 28px;
  --leo-chat-radius-msg: 20px;
  --leo-chat-radius-input: 18px;
  --leo-chat-radius-pill: 999px;
  --leo-chat-bg-card: rgba(255, 255, 255, 0.60);
  --leo-chat-bg-soft: rgba(255, 255, 255, 0.40);
  --leo-chat-bg-input: rgba(255, 255, 255, 0.80);
  --leo-chat-border: rgba(0, 0, 0, 0.10);
  --leo-chat-border-soft: rgba(0, 0, 0, 0.05);
  --leo-chat-text: #171717;
  --leo-chat-text-muted: #737373;
  --leo-chat-text-faint: #a3a3a3;
  --leo-chat-accent: #171717;
  --leo-chat-accent-hover: #262626;
  --leo-chat-ring: rgba(0, 0, 0, 0.20);
  --leo-chat-emerald: #10b981;
  --leo-chat-emerald-glow: 0 0 8px rgba(34, 197, 94, 0.6);
  --leo-chat-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --leo-chat-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Outer section (between hero & next row) ─── */
.leo-chat-section {
  padding: 56px 16px 64px;
  background: linear-gradient(180deg, #fafaf9 0%, #f5f4f1 100%);
  scroll-margin-top: 96px;
}
@media (min-width: 1024px) {
  .leo-chat-section { padding: 72px 24px 88px; }
}

.leo-chat-section-inner {
  max-width: 880px;
  margin: 0 auto;
}

.leo-chat-section-header {
  text-align: center;
  margin-bottom: 28px;
}
.leo-chat-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--leo-chat-text-muted);
  margin: 0;
}
.leo-chat-section-title {
  margin: 12px 0 0;
  font-family: Georgia, "Newsreader", "Times New Roman", serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--leo-chat-text);
}

/* ─── Card (glass) ─── */
.leo-chat-card {
  position: relative;
  border-radius: var(--leo-chat-radius-card);
  overflow: hidden;
  border: 1px solid var(--leo-chat-border);
  background: var(--leo-chat-bg-card);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
  box-shadow: var(--leo-chat-shadow);
  transition: box-shadow 0.3s var(--leo-chat-ease), border-color 0.3s var(--leo-chat-ease);
}
.leo-chat-card.is-dragging {
  border-color: var(--leo-chat-ring);
  box-shadow: 0 0 0 3px var(--leo-chat-ring), var(--leo-chat-shadow);
}

/* ─── Header ─── */
.leo-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--leo-chat-border-soft);
  background: var(--leo-chat-bg-soft);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.leo-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.leo-chat-pulse {
  position: relative;
  width: 8px;
  height: 8px;
}
.leo-chat-pulse::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #4ade80;
  opacity: 0.5;
  animation: leo-chat-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.leo-chat-pulse::after {
  content: "";
  position: relative;
  display: block;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--leo-chat-emerald);
  box-shadow: var(--leo-chat-emerald-glow);
}
@keyframes leo-chat-ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}
.leo-chat-brand-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--leo-chat-text-muted);
}
.leo-chat-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--leo-chat-radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--leo-chat-border-soft);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #404040;
}
.leo-chat-brand-badge svg { width: 12px; height: 12px; }
.leo-chat-brand-logo {
  height: 18px;
  width: auto;
  max-width: 64px;
  display: block;
  object-fit: contain;
}

/* ─── Messages area ─── */
.leo-chat-messages {
  position: relative;
  height: 300px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 640px) {
  .leo-chat-messages { height: 280px; padding: 14px; }
}

/* Empty state */
.leo-chat-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}
.leo-chat-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--leo-chat-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #525252;
  margin-bottom: 12px;
}
.leo-chat-empty-icon svg { width: 16px; height: 16px; }

.leo-chat-typewriter {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
  min-height: 1.6em;
  padding: 0 8px;
  color: var(--leo-chat-text);
  line-height: 1.3;
}
.leo-chat-typewriter-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: -0.15em;
  margin-left: 2px;
  background: var(--leo-chat-text);
  animation: leo-chat-caret 1s steps(2) infinite;
}
@keyframes leo-chat-caret {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.leo-chat-starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  margin-top: 6px;
}
.leo-chat-starter {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--leo-chat-radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--leo-chat-border);
  color: #525252;
  cursor: pointer;
  transition: background 0.2s var(--leo-chat-ease), color 0.2s var(--leo-chat-ease), transform 0.2s var(--leo-chat-ease);
}
.leo-chat-starter:hover {
  background: #fff;
  color: var(--leo-chat-text);
  transform: translateY(-1px);
}

/* ─── Bubbles ─── */
.leo-chat-msg {
  display: flex;
  gap: 12px;
  animation: leo-chat-msg-in 0.3s var(--leo-chat-ease);
}
@keyframes leo-chat-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.leo-chat-msg-user { justify-content: flex-end; }
.leo-chat-msg-assistant { justify-content: flex-start; }

.leo-chat-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--leo-chat-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #525252;
}
.leo-chat-avatar svg { width: 14px; height: 14px; }

.leo-chat-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--leo-chat-radius-msg);
  font-size: 15px;
  line-height: 1.55;
  word-wrap: break-word;
}
@media (min-width: 640px) {
  .leo-chat-bubble { font-size: 14px; max-width: 75%; }
}

.leo-chat-msg-user .leo-chat-bubble {
  background: var(--leo-chat-accent);
  color: #fff;
  border-bottom-right-radius: 6px;
  white-space: pre-wrap;
}
.leo-chat-msg-assistant .leo-chat-bubble {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--leo-chat-border-soft);
  color: var(--leo-chat-text);
  border-bottom-left-radius: 6px;
}

/* Markdown styling inside assistant bubble */
.leo-chat-bubble p { margin: 0 0 8px; }
.leo-chat-bubble p:last-child { margin-bottom: 0; }
.leo-chat-bubble ul, .leo-chat-bubble ol { margin: 0 0 8px; padding-left: 20px; }
.leo-chat-bubble li { margin-bottom: 2px; }
.leo-chat-bubble strong { font-weight: 600; }
.leo-chat-bubble em { font-style: italic; }
.leo-chat-bubble code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.92em;
}
.leo-chat-bubble h1, .leo-chat-bubble h2, .leo-chat-bubble h3 {
  font-size: 15px; font-weight: 600; margin: 4px 0 6px;
}
.leo-chat-bubble a { color: #1e40af; text-decoration: underline; }

/* Typing dots (initial assistant placeholder) */
.leo-chat-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.leo-chat-dots span {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
  animation: leo-chat-bounce 1.2s infinite ease-in-out;
}
.leo-chat-dots span:nth-child(2) { animation-delay: 0.15s; }
.leo-chat-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes leo-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* Streaming caret */
.leo-chat-stream-caret {
  display: inline-block;
  width: 4px;
  height: 1em;
  vertical-align: middle;
  margin-left: 2px;
  background: currentColor;
  animation: leo-chat-caret 1s steps(2) infinite;
}

/* Attachment chips in bubble */
.leo-chat-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.leo-chat-msg-attachment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.20);
  font-size: 12px;
  max-width: 160px;
}
.leo-chat-msg-user .leo-chat-msg-attachment {
  background: rgba(255, 255, 255, 0.18);
  color: #f5f5f5;
}
.leo-chat-msg-attachment svg { width: 12px; height: 12px; flex-shrink: 0; }
.leo-chat-msg-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Drag overlay ─── */
.leo-chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.04);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
.leo-chat-card.is-dragging .leo-chat-drop-overlay { display: flex; }
.leo-chat-drop-card {
  background: #fff;
  border: 2px dashed rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  padding: 26px 32px;
  text-align: center;
  color: var(--leo-chat-text);
}
.leo-chat-drop-card svg { width: 36px; height: 36px; margin-bottom: 4px; color: #404040; }
.leo-chat-drop-card p { margin: 0; font-weight: 500; }
.leo-chat-drop-card small { color: var(--leo-chat-text-muted); font-size: 13px; }

/* ─── Attachment chips below messages, above input ─── */
.leo-chat-attach-row {
  padding: 12px 20px;
  border-top: 1px solid var(--leo-chat-border-soft);
  background: var(--leo-chat-bg-soft);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}
.leo-chat-attach-row.is-visible { display: flex; }
.leo-chat-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  border-radius: var(--leo-chat-radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--leo-chat-border-soft);
  font-size: 12px;
}
.leo-chat-attach-chip svg { width: 13px; height: 13px; color: #525252; flex-shrink: 0; }
.leo-chat-attach-chip-name {
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leo-chat-attach-remove {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--leo-chat-text-faint);
  padding: 0;
  display: inline-flex;
  align-items: center;
}
.leo-chat-attach-remove:hover { color: #ef4444; }
.leo-chat-attach-remove svg { width: 13px; height: 13px; }

/* ─── Input row ─── */
.leo-chat-input-row {
  border-top: 1px solid var(--leo-chat-border-soft);
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.leo-chat-input-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.leo-chat-icon-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #404040;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--leo-chat-ease);
}
.leo-chat-icon-btn:hover:not(:disabled) { background: rgba(0, 0, 0, 0.05); }
.leo-chat-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.leo-chat-icon-btn svg { width: 19px; height: 19px; }
@media (min-width: 640px) {
  .leo-chat-icon-btn { width: 44px; height: 44px; }
  .leo-chat-icon-btn svg { width: 20px; height: 20px; }
}

.leo-chat-textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  border-radius: var(--leo-chat-radius-input);
  border: 1px solid var(--leo-chat-border);
  background: var(--leo-chat-bg-input);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--leo-chat-text);
  outline: none;
  transition: border-color 0.2s var(--leo-chat-ease), box-shadow 0.2s var(--leo-chat-ease);
}
.leo-chat-textarea::placeholder { color: var(--leo-chat-text-faint); }
.leo-chat-textarea:focus {
  border-color: rgba(0, 0, 0, 0.30);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}
.leo-chat-textarea:disabled { opacity: 0.5; }
@media (min-width: 640px) {
  .leo-chat-textarea { min-height: 48px; font-size: 15px; }
}

.leo-chat-send {
  background: var(--leo-chat-accent);
  color: #fff;
}
.leo-chat-send:hover:not(:disabled) { background: var(--leo-chat-accent-hover); }
.leo-chat-send:disabled { background: var(--leo-chat-accent); opacity: 0.4; pointer-events: none; }
.leo-chat-send .leo-chat-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 999px;
  animation: leo-chat-spin 0.8s linear infinite;
}
@keyframes leo-chat-spin { to { transform: rotate(360deg); } }

/* Disclaimer */
.leo-chat-disclaimer {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--leo-chat-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  line-height: 1.4;
}
.leo-chat-disclaimer svg { width: 12px; height: 12px; flex-shrink: 0; }

/* CTA after lead-capture marker */
.leo-chat-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--leo-chat-accent);
  color: #fff !important;
  border-radius: var(--leo-chat-radius-pill);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s var(--leo-chat-ease);
}
.leo-chat-cta:hover { background: var(--leo-chat-accent-hover); }

/* Hide native file input */
.leo-chat-file-input { display: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .leo-chat-pulse::before,
  .leo-chat-typewriter-caret,
  .leo-chat-stream-caret,
  .leo-chat-dots span,
  .leo-chat-msg { animation: none !important; }
}
