/* S28 T28.6 — Landing Asistanı sohbeti (ekt.one / eifu.one / eup.one).
   Görünüm KT sayfasındaki sohbetle aynı: kurallar frontend.css'in chat + chip bölümünden alındı
   (aynı sınıf adları). KT sohbet görünümü değişirse burayı da güncelleyin. */

.ekt-chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* Yarı saydam — altındaki metin okunur kalır, totop ile aynı renk ailesi */
    background: rgba(26, 86, 219, .55);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 86, 219, .25);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
/* Zemin ne olursa olsun ikon okunur kalsın — arka plan saydam olduğundan gölge şart */
.ekt-chat-fab svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55)); }
.ekt-chat-fab:hover { background: rgba(26, 86, 219, .85); transform: scale(1.07); }
.ekt-chat-fab:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.ekt-chat-fab--disabled { background: rgba(156, 163, 175, .55) !important; cursor: not-allowed; transform: none !important; }

/* Panel — sağ altta açılan kart */
.ekt-chat-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 440px;
    max-width: calc(100vw - 2rem);
    height: 640px;
    max-height: calc(100vh - 9rem);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 36px rgba(0, 0, 0, .20);
    display: flex;
    flex-direction: column;
    z-index: 999;
    opacity: 0;
    visibility: hidden;         /* kapalıyken odaklanamaz, erişilebilirlik ağacından çıkar */
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    overflow: hidden;
}
.ekt-chat-panel--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}

/* Header */
.ekt-chat-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #1a56db;
    color: #fff;
    flex-shrink: 0;
}
.ekt-chat-panel__title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}
.ekt-chat-panel__close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.85;
}
.ekt-chat-panel__close:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* Mesaj alanı */
.ekt-chat-spacer { flex: 1; min-height: 0; }
.ekt-chat-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: #f8fafc;
}

/* Mesaj baloncukları */
.ekt-chat-msg {
    max-width: 85%;
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}
.ekt-chat-msg--user {
    background: #1a56db;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    white-space: pre-wrap;   /* kullanıcı metninde satır sonlarını koru */
}
.ekt-chat-msg--assistant {
    background: #fff;
    color: #1f2937;
    align-self: flex-start;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 3px;
}
/* Markdown elementleri — assistant baloncuğu içinde */
.ekt-chat-msg--assistant h3,
.ekt-chat-msg--assistant h4,
.ekt-chat-msg--assistant h5,
.ekt-chat-msg--assistant h6 {
    margin: 0.5em 0 0.25em;
    font-size: 0.9rem;
    font-weight: 700;
}
.ekt-chat-msg--assistant p  { margin: 0.2em 0; }
.ekt-chat-msg--assistant ul { margin: 0.25em 0 0.25em 1.1em; padding: 0; }
.ekt-chat-msg--assistant li { margin: 0.15em 0; }
.ekt-chat-msg--assistant hr { border: none; border-top: 1px solid #e5e7eb; margin: 0.5em 0; }
.ekt-chat-msg--assistant blockquote {
    border-left: 3px solid #d1d5db;
    margin: 0.25em 0;
    padding-left: 0.6em;
    color: #6b7280;
    font-style: italic;
}
.ekt-chat-msg--assistant code {
    background: #f3f4f6;
    border-radius: 3px;
    padding: 0.1em 0.3em;
    font-size: 0.85em;
}
.ekt-chat-msg--assistant strong { font-weight: 700; }
.ekt-chat-msg--assistant em    { font-style: italic; }
.ekt-chat-msg--assistant del   { text-decoration: line-through; color: #6b7280; }
.ekt-chat-msg--assistant ol    { margin: 0.25em 0 0.25em 1.3em; padding: 0; }
.ekt-chat-msg--assistant a     { color: #2563eb; text-decoration: underline; word-break: break-all; }

/* Markdown tablo */
.ekt-chat-msg--assistant .ekt-md-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82em;
    margin: 0.4em 0;
    overflow-x: auto;
    display: block;
}
.ekt-chat-msg--assistant .ekt-md-table th,
.ekt-chat-msg--assistant .ekt-md-table td {
    border: 1px solid #d1d5db;
    padding: 4px 8px;
    text-align: left;
    white-space: nowrap;
}
.ekt-chat-msg--assistant .ekt-md-table thead th {
    background: #f3f4f6;
    font-weight: 600;
}

.ekt-chat-msg--loading {
    color: #6b7280;
    font-style: italic;
    animation: ekt-pulse 1.2s ease-in-out infinite;
}
@keyframes ekt-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* Input alanı */
.ekt-chat-panel__input {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
.ekt-chat-input {
    flex: 1;
    resize: none;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    background: #f3f4f6;
    transition: background 0.15s;
}
.ekt-chat-input:focus { background: #ebebeb; }
.ekt-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #1a56db;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.ekt-chat-send:hover { background: #1e40af; }
.ekt-chat-send:disabled { background: #9ca3af; cursor: default; }

/* ── STT Mic butonu ───────────────────────────────────────────────────────── */
.ekt-chat-mic {
    width: 47px;
    height: 47px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ekt-chat-mic:hover { background: #e0e7ff; color: #1d4ed8; border-color: #a5b4fc; }
.ekt-chat-mic--recording {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    animation: ekt-mic-pulse 1s ease-in-out infinite;
}
@keyframes ekt-mic-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.12); }
}

/* ── TTS Speaker butonu (AI mesaj içinde) ────────────────────────────────── */
.ekt-chat-msg__tts {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.4rem;
    padding: 0.2rem 0.55rem;
    background: transparent;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ekt-chat-msg__tts:hover { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.ekt-chat-msg__tts--speaking { color: #0369a1; border-color: #7dd3fc; background: #f0f9ff; }

/* ── Chat Chips ──────────────────────────────────────────────────────────── */
.ekt-chat-chips {
    padding: 0.1rem 0 0.25rem;
    width: 100%;
}
.ekt-chat-chips:empty { display: none; }
.ekt-chip-category {
    font-size: 0.68rem;
    color: #9ca3af;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.55rem 0 0.3rem;
}
.ekt-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.1rem;
}
.ekt-chip {
    display: inline-block;
    padding: 0.28rem 0.65rem;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    font-size: 0.775rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ekt-chip:hover {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}
.ekt-chip--followup {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}
.ekt-chip--followup:hover {
    background: #15803d;
    color: #fff;
    border-color: #15803d;
}


/* Landing'e özgü: panel altı bilgilendirme satırı */
.ekt-chat-disclaimer {
    flex-shrink: 0;
    padding: 0.35rem 1rem 0.55rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #6b7280;
    background: #fff;
    text-align: center;
}
@media print { .ekt-chat-fab, .ekt-chat-panel { display: none !important; } }

/* ── T28.7 İletişim formu (mesaj listesinde kart) ─────────────────────────── */
.ekt-lead-link {
    background: none; border: 0; padding: 0; color: #1a56db; font: inherit;
    text-decoration: underline; cursor: pointer;
}
.ekt-lead-form {
    display: flex; flex-direction: column; gap: 0.45rem;
    background: #f8fafc; border: 1px solid #dbe4f0; border-radius: 12px;
    padding: 0.85rem 0.9rem; font-size: 0.85rem; color: #1f2937;
}
.ekt-lead-form[hidden] { display: none; }
.ekt-lead-form__title { font-weight: 600; font-size: 0.95rem; }
.ekt-lead-form__intro, .ekt-lead-form__privacy { margin: 0; color: #4b5563; line-height: 1.4; }
.ekt-lead-form__privacy { font-size: 0.75rem; }
.ekt-lead-form label { display: flex; flex-direction: column; gap: 0.2rem; }
.ekt-lead-form input[type=text], .ekt-lead-form input[type=email], .ekt-lead-form input[type=tel],
.ekt-lead-form textarea {
    border: 1px solid #cbd5e1; border-radius: 8px; padding: 0.45rem 0.6rem; font: inherit; background: #fff;
    min-width: 0; width: 100%; box-sizing: border-box;
}
.ekt-lead-form input:focus-visible, .ekt-lead-form textarea:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.ekt-lead-form textarea { resize: vertical; min-height: 4.5rem; }
.ekt-lead-form__check { flex-direction: row !important; align-items: flex-start; gap: 0.45rem !important; line-height: 1.35; }
.ekt-lead-form__check input { margin-top: 0.15rem; flex-shrink: 0; }
.ekt-lead-form__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ekt-lead-form__error { color: #b91c1c; font-size: 0.8rem; }
.ekt-lead-form__error[hidden] { display: none; }
.ekt-lead-form__submit {
    align-self: flex-start; background: #1a56db; color: #fff; border: 0; border-radius: 8px;
    padding: 0.5rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.ekt-lead-form__submit:disabled { opacity: 0.6; cursor: wait; }
.ekt-lead-done a { color: #1a56db; font-weight: 600; }

/* Mobilde panel açıkken sohbet düğmesi paneli örtmesin (panelin kendi kapatma düğmesi var) */
@media (max-width: 640px) { body .ekt-chat-fab[aria-expanded="true"] { display: none; } }
