/* Turunç Asistan — sohbet penceresi */
.mpa-launcher,
.mpa-panel,
.mpa-panel * {
    box-sizing: border-box;
}
.mpa-launcher,
.mpa-panel {
    --mpa-navy: #002b5b;
    --mpa-blue: #004ea3;
    --mpa-gold: #f68937;
    --mpa-ink: #0f2744;
    --mpa-muted: #64748b;
    --mpa-line: #e2e8f0;
    --mpa-soft: #f4f7fb;
    font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, system-ui, sans-serif;
}

/* —— Açma düğmesi —— */
.mpa-launcher {
    position: fixed;
    right: 16px;
    bottom: 80px;
    z-index: 100000005;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    height: 52px;
    padding: 0 1.1rem 0 0.35rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--mpa-gold) 0%, #e57828 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(246, 137, 55, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.mpa-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(246, 137, 55, 0.48); }
.mpa-launcher:focus-visible { outline: 3px solid var(--mpa-blue); outline-offset: 3px; }
.mpa-launcher__icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.mpa-launcher.is-open .mpa-launcher__label { display: none; }
.mpa-launcher.is-open { padding-right: 0.35rem; }

/* —— Telefonda düğmenin yanındaki selam balonu —— */
.mpa-hint {
    --mpa-ink: #0f2744;
    position: fixed;
    right: 80px;
    bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    z-index: 100000005;
    max-width: calc(100vw - 164px);
    margin: 0;
    padding: 0.6rem 0.85rem;
    border: none;
    border-radius: 14px;
    background: #fff;
    color: var(--mpa-ink);
    font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, system-ui, sans-serif;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(0, 43, 91, 0.28), 0 0 0 1px rgba(0, 43, 91, 0.06);
    opacity: 0;
    transform: translateX(10px) scale(0.96);
    transform-origin: right center;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.mpa-hint::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: 14px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    border-radius: 2px;
}
.mpa-hint.is-visible { opacity: 1; transform: none; }
.mpa-launcher.is-nudging { animation: mpa-ring 1.6s ease-out 3; }

/* —— Pencere —— */
.mpa-panel {
    position: fixed;
    right: 16px;
    bottom: 144px;
    z-index: 100000006;
    width: 384px;
    max-width: calc(100vw - 32px);
    height: min(620px, calc(100vh - 168px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    color: var(--mpa-ink);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 43, 91, 0.28), 0 0 0 1px rgba(0, 43, 91, 0.06);
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.mpa-panel[hidden] { display: none; }
.mpa-panel.is-open { opacity: 1; transform: none; }

.mpa-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 0.75rem 0.8rem 0.9rem;
    background: linear-gradient(135deg, var(--mpa-navy) 0%, var(--mpa-blue) 100%);
    color: #fff;
    flex-shrink: 0;
}
.mpa-head__avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--mpa-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.mpa-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mpa-head__text strong { font-family: Montserrat, "Segoe UI", sans-serif; font-size: 0.98rem; font-weight: 700; line-height: 1.2; }
.mpa-head__text small { font-size: 0.74rem; opacity: 0.8; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpa-head__btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.mpa-head__btn:hover { background: rgba(255, 255, 255, 0.24); }
.mpa-head__btn.is-on { background: var(--mpa-gold); }
.mpa-head__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* —— Mesaj akışı —— */
.mpa-log {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.9rem 0.8rem 0.6rem;
    background: var(--mpa-soft);
    outline: none;
}
.mpa-row { display: flex; margin-bottom: 0.55rem; }
.mpa-row--user { justify-content: flex-end; }
.mpa-bubble {
    max-width: 88%;
    padding: 0.65rem 0.85rem;
    border-radius: 16px;
    overflow-wrap: anywhere;
    animation: mpa-in 0.22s ease both;
}
.mpa-row--bot .mpa-bubble {
    background: #fff;
    border: 1px solid var(--mpa-line);
    border-bottom-left-radius: 5px;
    color: var(--mpa-ink);
}
.mpa-row--user .mpa-bubble {
    background: var(--mpa-blue);
    color: #fff;
    border-bottom-right-radius: 5px;
}
.mpa-bubble__title {
    display: block;
    margin-bottom: 0.35rem;
    font-family: Montserrat, "Segoe UI", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--mpa-navy);
}
.mpa-bubble p { margin: 0 0 0.45rem; }
.mpa-bubble p:last-child { margin-bottom: 0; }
.mpa-bubble strong { font-weight: 700; }
.mpa-list {
    margin: 0 0 0.45rem;
    padding: 0 0 0 1.1rem !important;
    list-style: disc;
}
.mpa-list li { margin: 0 0 0.2rem; padding: 0; list-style: disc; }
.mpa-list li::marker { color: var(--mpa-gold); }

.mpa-links { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.6rem; }
.mpa-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(0, 78, 163, 0.25);
    border-radius: 10px;
    background: #eef5fc;
    color: var(--mpa-blue) !important;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.mpa-link:hover,
.mpa-link:focus-visible { background: var(--mpa-blue); border-color: var(--mpa-blue); color: #fff !important; }
.mpa-link i { flex-shrink: 0; font-size: 0.85rem; }

.mpa-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.8rem; animation: mpa-in 0.22s ease both; }
.mpa-chip {
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(246, 137, 55, 0.55);
    border-radius: 999px;
    background: #fff;
    color: #b4520f;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.mpa-chip:hover,
.mpa-chip:focus-visible { background: var(--mpa-gold); border-color: var(--mpa-gold); color: #fff; }
.mpa-chip--ghost { border-color: var(--mpa-line); color: var(--mpa-muted); }
.mpa-chip--ghost:hover,
.mpa-chip--ghost:focus-visible { background: var(--mpa-ink); border-color: var(--mpa-ink); color: #fff; }

.mpa-typing .mpa-bubble { display: inline-flex; gap: 4px; padding: 0.8rem 0.9rem; }
.mpa-typing .mpa-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: mpa-dot 1s infinite ease-in-out;
}
.mpa-typing .mpa-bubble span:nth-child(2) { animation-delay: 0.15s; }
.mpa-typing .mpa-bubble span:nth-child(3) { animation-delay: 0.3s; }

/* —— Yazma alanı —— */
.mpa-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.6rem 0.65rem;
    border-top: 1px solid var(--mpa-line);
    background: #fff;
    flex-shrink: 0;
}
.mpa-form__input {
    flex: 1;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 0 0.9rem;
    border: 1px solid var(--mpa-line);
    border-radius: 999px;
    background: var(--mpa-soft);
    color: var(--mpa-ink);
    font: inherit;
    font-size: 16px; /* iOS'ta odaklanınca yakınlaştırmayı önler */
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.mpa-form__input:focus { border-color: var(--mpa-blue); background: #fff; }
.mpa-form__mic,
.mpa-form__send {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}
.mpa-form__mic { background: var(--mpa-soft); color: var(--mpa-blue); border: 1px solid var(--mpa-line); }
.mpa-form__mic:hover { background: #e6eef8; }
.mpa-form__mic.is-on { background: #dc2626; border-color: #dc2626; color: #fff; animation: mpa-pulse 1.2s infinite; }
.mpa-form__mic[hidden] { display: none; }
.mpa-form__send { background: var(--mpa-blue); color: #fff; }
.mpa-form__send:hover { background: var(--mpa-navy); transform: translateY(-1px); }
.mpa-form__mic:focus-visible,
.mpa-form__send:focus-visible { outline: 3px solid rgba(0, 78, 163, 0.35); outline-offset: 2px; }

.mpa-note {
    margin: 0;
    padding: 0 0.8rem 0.5rem;
    background: #fff;
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.3;
    text-align: center;
    flex-shrink: 0;
}

@keyframes mpa-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mpa-dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes mpa-ring {
    0% { box-shadow: 0 8px 24px rgba(246, 137, 55, 0.4), 0 0 0 0 rgba(246, 137, 55, 0.55); }
    100% { box-shadow: 0 8px 24px rgba(246, 137, 55, 0.4), 0 0 0 16px rgba(246, 137, 55, 0); }
}
@keyframes mpa-pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); } 100% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); } }

/* —— Tablet / telefon: düğme sağ alt köşede, soldaki erişilebilirlik düğmesiyle aynı hizada —— */
@media (max-width: 991px) {
    .mpa-launcher {
        right: 16px;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        width: 52px;
        padding: 0;
        justify-content: center;
    }
    .mpa-launcher__label { display: none; }
    .mpa-launcher__icon { background: transparent; }
    .mpa-panel { right: 16px; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); height: min(620px, calc(100vh - 166px)); }

    /* "Yukarı çık" düğmesi asistanın üstüne taşınır */
    #button.back-top,
    #button {
        right: 20px;
        bottom: calc(152px + env(safe-area-inset-bottom, 0px)) !important;
    }
    /* Ana sayfadaki uygulama kutusunun yazısı sağdaki asistan ve soldaki erişilebilirlik düğmesinin altında kalmasın */
    .app-promo:not([hidden]) { padding-left: 1.75rem; padding-right: 4.75rem; }
}

/* —— Telefon: tam ekran —— */
@media (max-width: 768px) {
    .mpa-panel {
        inset: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        transform: translateY(20px);
    }
    .mpa-head { padding-top: calc(0.8rem + env(safe-area-inset-top, 0px)); }
    .mpa-note { padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
    .mpa-bubble { max-width: 92%; }
    html.mpa-open,
    html.mpa-open body { overflow: hidden !important; }
}

@media (prefers-reduced-motion: reduce) {
    .mpa-panel,
    .mpa-launcher,
    .mpa-launcher.is-nudging,
    .mpa-hint,
    .mpa-bubble,
    .mpa-chips { transition: none; animation: none; }
    .mpa-typing .mpa-bubble span,
    .mpa-form__mic.is-on { animation: none; }
}

@media print {
    .mpa-launcher,
    .mpa-hint,
    .mpa-panel { display: none !important; }
}
