/*
 * Ana sayfa (misafir) Lila — robot + yüzen sohbet kartı (1 Eki 2026).
 * Şablon includes/_lila_guest_float.html, davranış js/marketing/lila_guest_float.js.
 * Robot katmanları/animasyonları css/chat/lila_mascot.css'ten gelir; burada yalnız
 * landing'e özgü konum + kart. Görünüm üye panelindeki yüzen kartla (css/chat/lila_float.css)
 * aynı dil: leylak palet, açık leylak degrade başlık, robota bakan kuyruk.
 * Mesaj sınıfları (.la-msg, .la-starter, .la-form …) lila_asistan.js'in ürettiği yapı.
 */

.lgf {
    --lgf-accent: #7c5cd6;
    --lgf-accent-dark: #6445c0;
    --lgf-soft: #f3effd;
    --lgf-lavender: #ede7fd;
    --lgf-line: #ebe6f7;
    --lgf-ink: #1f2937;
    --lgf-muted: #6b7280;
    font-family: inherit;
}

/* ─── Robot: lila_orb.css landing'de yok → konum/etkileşim burada ─── */
.lgf-robot {
    position: fixed;
    z-index: 1035;
    padding: 0;
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transition: opacity 0.3s ease, bottom 0.25s ease;
}

.lgf.is-ready .lgf-robot {
    opacity: 1;
}

/* Mobil yapışkan "Binamı göster" çubuğu görünürken robot üstüne çıkar */
@media (max-width: 760px) {
    #lila-orb.lila-mascot.lgf-robot {
        width: 56px;
        height: 66px;
        right: 12px !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body:has([data-pt-sticky]:not([hidden])) #lila-orb.lila-mascot.lgf-robot {
        bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ─── Kart ─────────────────────────────────────────────────────── */
.lgf-card {
    position: fixed;
    z-index: 1036;
    right: 20px;
    bottom: 112px;
    width: 380px;
    height: min(600px, calc(100vh - 140px));
    height: min(600px, calc(100dvh - 140px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(124, 92, 214, 0.16);
    border-radius: 24px;
    box-shadow:
        0 28px 70px -18px rgba(46, 26, 102, 0.30),
        0 10px 28px -10px rgba(76, 29, 149, 0.16);
    color: var(--lgf-ink);
    font-size: 14.5px;
    line-height: 1.55;
    opacity: 0;
    transform: translateY(14px) scale(0.92);
    transform-origin: calc(100% - 28px) calc(100% + 40px);
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.lgf-card[hidden] {
    display: none;
}

.lgf-card.is-open {
    opacity: 1;
    transform: none;
}

/* 14 Eki 2026: parsel değerlendirme sonucu gelince kart sağdan kayarak açılır
   (lila_guest_float.js is-from-right; yalnız ≥992px'te kendiliğinden açılır). */
.lgf-card.is-from-right:not(.is-open) {
    transform: translateX(calc(100% + 40px));
}

/* Robota bakan kuyruk */
.lgf-card::after {
    content: '';
    position: absolute;
    right: 21px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-right: 1px solid rgba(124, 92, 214, 0.16);
    border-bottom: 1px solid rgba(124, 92, 214, 0.16);
    border-bottom-right-radius: 4px;
    transform: rotate(45deg);
}

/* ─── Başlık ───────────────────────────────────────────────────── */
.lgf-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    border-radius: 24px 24px 0 0;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(221, 210, 252, 0.9) 0%, rgba(221, 210, 252, 0) 62%),
        linear-gradient(135deg, #f6f2ff 0%, #ece5fd 100%);
}

.lgf-avatar,
.lgf .la-orb--sm {
    flex: none;
    display: block;
    border-radius: 50%;
    background: #fff url("../../img/lila/lila_avatar.15f1c88e5d4d.webp") no-repeat center 2px / 112% auto;
}

.lgf-avatar {
    width: 44px;
    height: 44px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7), 0 6px 14px -6px rgba(49, 46, 129, 0.35);
}

.lgf-head__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.lgf-head__text b {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.lgf-online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.lgf-head__text small {
    margin-top: 2px;
    font-size: 12.5px;
    color: #5b4f86;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lgf-close {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #334155;
    cursor: pointer;
}

.lgf-close:hover {
    background: rgba(255, 255, 255, 0.75);
}

/* ─── Mesajlar ─────────────────────────────────────────────────── */
.lgf-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, #fbfaff 0%, #ffffff 120px);
}

.lgf-body > * {
    flex-shrink: 0;
}

.lgf .la-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.lgf .la-orb--sm {
    width: 30px;
    height: 30px;
    background-color: var(--lgf-lavender);
}

.lgf .la-msg__bubble {
    min-width: 0;
    overflow-wrap: anywhere;
}

.lgf .la-msg__bubble p {
    margin: 0 0 8px;
}

.lgf .la-msg__bubble p:last-child {
    margin-bottom: 0;
}

.lgf .la-msg__bubble ul,
.lgf .la-msg__bubble ol {
    margin: 4px 0 8px;
    padding-left: 20px;
}

.lgf .la-msg--lila .la-msg__bubble {
    padding-top: 4px;
}

.lgf .la-msg--user {
    justify-content: flex-end;
}

.lgf .la-msg--user .la-msg__bubble {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 16px 16px 4px 16px;
    background: var(--lgf-soft);
    color: #2e1f66;
}

.lgf .la-msg--error .la-msg__bubble {
    padding: 9px 13px;
    border-radius: 12px;
    background: #fef2f2;
    color: #991b1b;
}

/* Yazıyor göstergesi */
.lgf .la-typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 14px;
    background: var(--lgf-soft);
    color: #5b4f86;
    font-size: 13px;
}

.lgf .la-typing__dots {
    display: inline-flex;
    gap: 3px;
}

.lgf .la-typing__dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--lgf-accent);
    animation: lgf-dot 1.2s ease-in-out infinite;
}

.lgf .la-typing__dots i:nth-child(2) { animation-delay: 0.15s; }
.lgf .la-typing__dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes lgf-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* Başlangıç soruları */
.lgf .la-starters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 40px;
}

.lgf .la-starters__label {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--lgf-muted);
}

.lgf .la-starter {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lgf-line);
    border-radius: 14px;
    background: #fff;
    color: var(--lgf-ink);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.lgf .la-starter:hover:not(:disabled) {
    border-color: rgba(124, 92, 214, 0.45);
    background: var(--lgf-soft);
}

.lgf .la-starter:disabled {
    cursor: default;
}

.lgf .la-starter__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--lgf-soft);
    color: var(--lgf-accent);
    font-size: 14px;
}

.lgf .la-starter__label {
    flex: 1;
}

.lgf .la-starter__chev {
    color: #a1a1b5;
    font-size: 12px;
}

/* Kayıt çağrısı / tekrar dene */
.lgf .la-cta,
.lgf .la-retry {
    align-self: flex-start;
    margin-left: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.lgf .la-cta {
    border: 0;
    background: var(--lgf-accent);
    color: #fff;
}

.lgf .la-cta:hover {
    background: var(--lgf-accent-dark);
    color: #fff;
}

.lgf .la-retry {
    border: 1px solid rgba(124, 92, 214, 0.4);
    background: #fff;
    color: var(--lgf-accent-dark);
}

/* ─── Giriş ────────────────────────────────────────────────────── */
.lgf-foot {
    padding: 10px 14px 10px;
    border-top: 1px solid var(--lgf-line);
    border-radius: 0 0 24px 24px;
    background: #fff;
}

.lgf .la-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.lgf .la-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 5px 5px 14px;
    border: 1px solid #e2d9fa;
    border-radius: 16px;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lgf .la-form:focus-within {
    border-color: var(--lgf-accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 214, 0.12);
}

.lgf .la-form__input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--lgf-ink);
    font: inherit;
    font-size: 16px; /* iOS odakta yakınlaştırmasın */
}

.lgf .la-form__input::placeholder {
    color: #9ca3af;
}

.lgf .la-form__send,
.lgf .la-form__cancel {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

.lgf .la-form__send {
    background: var(--lgf-accent);
    color: #fff;
}

.lgf .la-form__send:hover:not(:disabled) {
    background: var(--lgf-accent-dark);
}

.lgf .la-form__send:disabled {
    background: #d9d0f5;
    cursor: default;
}

.lgf .la-form__cancel {
    background: var(--lgf-soft);
    color: var(--lgf-accent-dark);
}

.lgf .la-form__cancel[hidden] {
    display: none;
}

.lgf-note {
    margin: 7px 0 0;
    font-size: 11.5px;
    color: var(--lgf-muted);
    text-align: center;
}

.lgf-note a {
    color: var(--lgf-accent-dark);
    font-weight: 700;
    text-decoration: none;
}

/* ─── Mobil: alttan açılan sayfa; robot kart açıkken gizlenir ─── */
@media (max-width: 600px) {
    .lgf-card {
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: min(640px, calc(100dvh - 72px));
        transform: translateY(24px);
        transform-origin: 50% 100%;
    }

    .lgf-card::after {
        display: none;
    }

    body.lgf-open #lila-orb.lgf-robot {
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lgf-card,
    .lgf-card.is-open,
    .lgf-card.is-from-right:not(.is-open) {
        transform: none;
        transition: opacity 0.15s ease;
    }

    .lgf .la-typing__dots i {
        animation: none;
    }
}

body.lgf-open .lila-mascot-bubble {
    display: none;
}

/* ─── Parsel değerlendirme (14 Eki 2026) ─────────────────────────
   Alttaki yapışkan kayıt çubuğu (body.pd-sticky-on, ~76px) görünürken robot,
   balon ve kart üstüne çıkar — "Ücretsiz kaydet" düğmesini örtmesin. Sonuç
   balonu (is-result) dar ekranda da görünür; diğer balonlar <992px gizli kalır. */
body.pd-sticky-on #lila-orb.lila-mascot.lgf-robot {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
}

body.pd-sticky-on .lgf-card {
    bottom: 180px;
    height: min(600px, calc(100vh - 210px));
    height: min(600px, calc(100dvh - 210px));
}

body.pd-sticky-on .lila-mascot-bubble {
    bottom: 126px;
}

@media (max-width: 991.98px) {
    .lgf .lila-mascot-bubble.is-result {
        display: flex !important;
        right: 76px;
        bottom: 34px;
    }

    body.pd-sticky-on .lgf .lila-mascot-bubble.is-result {
        bottom: 110px;
    }
}

@media (max-width: 600px) {
    body.pd-sticky-on .lgf-card {
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        height: min(640px, calc(100dvh - 72px));
    }
}
