/* ==========================================
   SİTE ASİSTANI — sağ altta sohbet düğmesi ve penceresi
   ========================================== */
.ai {
    --ai-ink: #0d0d0d;
    --ai-brand: #ffdd00;
    --ai-dark: #1c1c1c;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 950;
    font-family: inherit;
}

.ai__fab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 8px;
    border: 0;
    border-radius: 999px;
    background: var(--ai-dark);
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.55);
    transition: transform 0.25s ease;
}

.ai__fab:hover {
    transform: translateY(-3px);
}

.ai__fab-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ai-brand);
    color: var(--ai-ink);
}

.ai__fab-icon svg {
    width: 22px;
    height: 22px;
}

.ai.is-open .ai__fab {
    display: none;
}

.ai__panel {
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 110px));
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    color: var(--ai-ink);
    box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(13, 13, 13, 0.06);
    animation: ai-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai__panel[hidden] {
    display: none;
}

@keyframes ai-in {
    from { opacity: 0; translate: 0 16px; }
}

.ai__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    background: var(--ai-brand);
}

.ai__avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ai-ink);
    color: var(--ai-brand);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.ai__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.ai__sub {
    margin: 2px 0 0;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.7;
}

.ai__close {
    display: grid;
    place-items: center;
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(13, 13, 13, 0.1);
    color: var(--ai-ink);
    cursor: pointer;
}

.ai__close svg {
    width: 16px;
    height: 16px;
}

.ai__log {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    overflow-y: auto;
    background: #f4f3f1;
}

.ai__msg {
    max-width: 88%;
}

.ai__msg p {
    margin: 0;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ai__msg--bot p {
    background: #fff;
    border-bottom-left-radius: 4px;
}

.ai__msg--user {
    align-self: flex-end;
}

.ai__msg--user p {
    background: var(--ai-dark);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai__links,
.ai__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai__links a {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ai-brand);
    color: var(--ai-ink);
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
}

.ai__chips button {
    padding: 7px 12px;
    border: 1px solid rgba(13, 13, 13, 0.14);
    border-radius: 999px;
    background: #fff;
    color: var(--ai-ink);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ai__chips button:hover {
    background: var(--ai-brand);
    border-color: var(--ai-brand);
}

.ai__typing {
    display: flex;
    gap: 4px;
    padding: 14px;
    border-radius: 16px;
    background: #fff;
    align-self: flex-start;
}

.ai__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(13, 13, 13, 0.35);
    animation: ai-dot 1s ease-in-out infinite;
}

.ai__typing span:nth-child(2) { animation-delay: 0.15s; }
.ai__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-dot {
    50% { translate: 0 -4px; background: var(--ai-ink); }
}

.ai__form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(13, 13, 13, 0.08);
    background: #fff;
}

.ai__form input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(13, 13, 13, 0.14);
    border-radius: 14px;
    font: inherit;
    font-size: 0.85rem;
    outline: none;
}

.ai__form input:focus {
    border-color: var(--ai-ink);
}

.ai__form button {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    border: 0;
    border-radius: 14px;
    background: var(--ai-ink);
    color: var(--ai-brand);
    cursor: pointer;
}

.ai__form button svg {
    width: 20px;
    height: 20px;
}

/* --- Sohbet öncesi bilgi formu --- */
.ai__intro {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px;
    overflow-y: auto;
    background: #f4f3f1;
}

.ai__intro[hidden],
.ai__log[hidden],
.ai__form[hidden] {
    display: none;
}

.ai__intro-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.ai__intro-text {
    margin: -4px 0 4px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #5a5a5a;
}

.ai__field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ai__field span {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ai__field input {
    padding: 11px 13px;
    border: 1px solid rgba(13, 13, 13, 0.14);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 0.86rem;
    outline: none;
}

.ai__field input:focus {
    border-color: var(--ai-ink);
}

.ai__field input.is-invalid,
.ai__check input.is-invalid {
    border-color: #d93025;
    box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.12);
}

.ai__field small,
.ai__check-error {
    min-height: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #d93025;
}

.ai__field small:empty,
.ai__check-error:empty {
    display: none;
}

.ai__check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 2px;
    font-size: 0.74rem;
    line-height: 1.5;
    cursor: pointer;
}

.ai__check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--ai-ink);
}

.ai__check a {
    color: var(--ai-ink);
    font-weight: 800;
}

.ai__start {
    margin-top: 6px;
    padding: 13px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--ai-ink);
    color: var(--ai-brand);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
}

.ai__start:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Çerez bildirimi açıkken düğme onun üstünde durur */
@media (max-width: 900px) {
    body:has(.cc.is-in) .ai {
        bottom: 190px;
    }
}

@media (max-width: 700px) {
    .ai {
        right: 12px;
        bottom: 12px;
    }

    .ai__fab-label {
        display: none;
    }

    .ai__fab {
        padding: 6px;
    }

    .ai.is-open {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .ai__panel {
        width: 100%;
        height: min(600px, calc(100dvh - 16px));
    }
}
