@charset "UTF-8";

/* =====================================================================
 * PromoLife  |  softiga-ai.css
 * Yerlesim  : assets/css/softiga-ai.css
 * ---------------------------------------------------------------------
 * AI Asistan paneli (widget_footer.php icindeki #sf_chat_panel).
 * Masaustunde kayan butonlarin solunda kart, telefonda alttan acilan
 * tam genislik panel olarak gorunur. Renkler --pl-* degiskenlerindendir.
 * ===================================================================== */

/* --- Panel --- */
.sf-chat.sf-ai {
    right: 74px;
    bottom: 18px;
    z-index: 1050;
    width: 380px;
    max-width: calc(100vw - 92px);
    height: min(620px, calc(100vh - 110px));
    border: 1px solid var(--pl-line);
    border-radius: var(--pl-radius-lg);
    background: var(--pl-surface);
    overflow: hidden;
}

.sf-chat.sf-ai.is-open {
    display: flex;
    flex-direction: column;
    animation: sfAiIn .24s var(--pl-ease) both;
}

@keyframes sfAiIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* --- Ust bolum --- */
.sf-ai-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 12px 10px 12px 14px;
    background: linear-gradient(90deg, var(--pl-navy) 0%, var(--pl-navy-soft) 60%, var(--pl-blue) 130%);
    color: #fff;
}

.sf-ai-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.sf-ai-avatar svg { width: 20px; height: 20px; }

.sf-ai-head-txt {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.sf-ai-title {
    overflow: hidden;
    font-size: 14.6px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sf-ai-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    overflow: hidden;
    font-size: 11.8px;
    opacity: .88;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sf-ai-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #3ddc84;
}

.sf-ai .sf-ai-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: .9;
    transition: background var(--pl-speed-fast) ease, opacity var(--pl-speed-fast) ease;
}

.sf-ai .sf-ai-iconbtn:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.sf-ai .sf-ai-iconbtn svg { width: 17px; height: 17px; }

.sf-ai .sf-ai-iconbtn:focus-visible,
.sf-ai-chip:focus-visible,
.sf-ai-send:focus-visible,
.sf-ai-card:focus-visible {
    outline: 2px solid var(--pl-blue);
    outline-offset: 2px;
}

/* --- Mesajlar --- */
.sf-ai-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    background: var(--pl-surface-2);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--pl-line-strong) transparent;
}

.sf-ai-msg {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 88%;
}

.sf-ai-msg.is-user { align-self: flex-end; align-items: flex-end; }
.sf-ai-msg.is-bot  { align-self: flex-start; }

.sf-ai-bubble {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.6px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.sf-ai-msg.is-bot .sf-ai-bubble {
    border: 1px solid var(--pl-line);
    border-bottom-left-radius: 5px;
    background: var(--pl-surface);
    color: var(--pl-ink);
}

.sf-ai-msg.is-user .sf-ai-bubble {
    border-bottom-right-radius: 5px;
    background: var(--pl-navy);
    color: var(--pl-on-navy);
    white-space: pre-wrap;
}

.sf-ai-bubble p { margin: 0 0 8px; }
.sf-ai-bubble p:last-child { margin-bottom: 0; }
.sf-ai-bubble strong { font-weight: 700; }

.sf-ai-bubble ul {
    margin: 4px 0 8px;
    padding-left: 18px;
}

.sf-ai-bubble ul:last-child { margin-bottom: 0; }
.sf-ai-bubble li { margin: 2px 0; }

.sf-ai-msg.is-error .sf-ai-bubble {
    border-color: #f3d2cd;
    background: #fdf2f0;
    color: #8c2f22;
}

/* Yaziyor gostergesi */
.sf-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 13px 14px;
}

.sf-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pl-muted);
    opacity: .4;
    animation: sfAiDot 1.1s ease-in-out infinite;
}

.sf-ai-typing span:nth-child(2) { animation-delay: .15s; }
.sf-ai-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes sfAiDot {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* --- Urun kartlari --- */
.sf-ai-cards {
    display: grid;
    gap: 6px;
    width: 100%;
}

.sf-ai-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 7px 7px;
    border: 1px solid var(--pl-line);
    border-radius: 12px;
    background: var(--pl-surface);
    color: var(--pl-ink);
    text-decoration: none;
    transition: border-color var(--pl-speed-fast) ease;
}

.sf-ai-card:hover { border-color: var(--pl-blue); color: var(--pl-ink); text-decoration: none; }

.sf-ai-card-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 9px;
    background: var(--pl-surface-2);
    overflow: hidden;
}

.sf-ai-card-img img {
    width: 100%;
    height: 100%;
    padding: 3px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.sf-ai-card-txt {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}

.sf-ai-card-code { color: var(--pl-navy); font-size: 11px; font-weight: 700; letter-spacing: .3px; }

.sf-ai-card-name {
    overflow: hidden;
    font-size: 12.8px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sf-ai-card-meta {
    overflow: hidden;
    color: var(--pl-muted);
    font-size: 11.4px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sf-ai-card > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    color: var(--pl-muted);
}

/* --- Oneri cipleri --- */
.sf-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sf-ai-chip {
    padding: 7px 11px;
    border: 1px solid var(--pl-line-strong);
    border-radius: var(--pl-radius-pill);
    background: var(--pl-surface);
    color: var(--pl-navy);
    font-family: inherit;
    font-size: 12.4px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background var(--pl-speed-fast) ease, border-color var(--pl-speed-fast) ease;
}

.sf-ai-chip:hover { border-color: var(--pl-navy); background: var(--pl-navy-tint); }

.sf-ai-chip:disabled { opacity: .5; cursor: default; }

/* --- Yazma alani --- */
.sf-ai-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 10px 8px 12px;
    border-top: 1px solid var(--pl-line);
    background: var(--pl-surface);
}

.sf-ai-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.sf-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    max-height: 120px;
    padding: 11px 12px;
    border: 1px solid var(--pl-line);
    border-radius: 12px;
    background: var(--pl-surface-2);
    color: var(--pl-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: none;
    outline: 0;
    transition: border-color var(--pl-speed-fast) ease, background var(--pl-speed-fast) ease;
}

.sf-ai-input:focus { border-color: var(--pl-blue); background: var(--pl-surface); }

.sf-ai-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--pl-navy);
    color: var(--pl-on-navy);
    cursor: pointer;
    transition: background var(--pl-speed-fast) ease, opacity var(--pl-speed-fast) ease;
}

.sf-ai-send:hover { background: var(--pl-blue); }
.sf-ai-send:disabled { opacity: .45; cursor: default; }
.sf-ai-send svg { width: 19px; height: 19px; }

.sf-ai-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 8px;
    flex: 0 0 auto;
    padding: 0 12px 10px;
    background: var(--pl-surface);
    color: var(--pl-muted);
    font-size: 11px;
    line-height: 1.4;
}

.sf-ai-foot a {
    color: var(--pl-navy);
    font-weight: 700;
    text-decoration: none;
}

.sf-ai-foot a:hover { color: var(--pl-blue); }

/* Kayan buton: AI isareti */
.sf-fab .sf-fab-ai { background: linear-gradient(135deg, var(--pl-navy) 0%, var(--pl-blue) 100%); }
.sf-fab .sf-fab-ai:hover { background: linear-gradient(135deg, var(--pl-navy-deep) 0%, var(--pl-blue-deep) 100%); }

/* --- Telefon: alttan acilan panel --- */
@media (max-width: 767.98px) {

    .sf-chat.sf-ai {
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        height: min(640px, calc(100vh - 76px));
        height: min(640px, calc(100dvh - 76px));
        border-radius: 18px;
    }

    .sf-ai-msg { max-width: 92%; }

    /* iOS'ta odaklaninca yakinlastirmayi engeller */
    .sf-ai-input { font-size: 16px; }
}

@media (max-width: 767.98px) and (orientation: landscape) {
    .sf-chat.sf-ai { height: calc(100vh - 16px); height: calc(100dvh - 16px); }
}

@media (prefers-reduced-motion: reduce) {
    .sf-chat.sf-ai.is-open { animation: none; }
    .sf-ai-typing span { animation: none; opacity: .7; }
}
