/* ==========================================================================
   تكسي سوريا — بوت المساعدة
   --------------------------------------------------------------------------
   البوت بيرد من كلام مكتوب جوّا الصفحة، فما في تحميل ولا انتظار.
   الحركة كلها transform وopacity، والنافذة ما بتتجاوز الشاشة على الموبايل.
   ========================================================================== */

.ts-bot {
    position: fixed;
    inset-inline-end: 18px;
    bottom: 18px;
    z-index: 950;
    font-family: var(--tsx-body, system-ui, sans-serif);
}

/* الزر العايم */
.ts-bot__fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(150deg, var(--tsx-amber, #e9a412), var(--tsx-amber-deep, #b87c04));
    color: var(--tsx-night, #16202e);
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    box-shadow: 0 6px 20px -6px rgba(233, 164, 18, .8), 0 2px 6px rgba(0, 0, 0, .2);
    transition: transform .16s ease, box-shadow .2s ease;
}
.ts-bot__fab:hover  { transform: translateY(-2px); }
.ts-bot__fab:active { transform: translateY(1px); }
.ts-bot__fab-icon   { font-size: 1.1rem; line-height: 1; }

.ts-bot.is-open .ts-bot__fab { display: none; }

/* النافذة */
.ts-bot__panel {
    width: min(360px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--tsx-surface, #fff);
    border: 1px solid var(--tsx-line, #dcdfe6);
    border-radius: 18px;
    box-shadow: 0 20px 50px -20px rgba(15, 23, 42, .55), 0 2px 8px rgba(0, 0, 0, .12);
    animation: ts-bot-in .22s cubic-bezier(.2, .7, .3, 1);
}
.ts-bot__panel[hidden] { display: none; }

@keyframes ts-bot-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.ts-bot__head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 16px;
    background: var(--tsx-night, #16202e);
    color: #fff;
    position: relative;
}
/* خط ألوان العلم — نفس توقيع الموقع */
.ts-bot__head::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg,
        #007a3d 0 33.34%, #fff 33.34% 66.67%, #101010 66.67% 100%);
}

.ts-bot__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
}
.ts-bot__title { flex: 1; font-weight: 700; font-size: .96rem; }

.ts-bot__close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.ts-bot__close:hover { background: rgba(255, 255, 255, .22); }

/* المحادثة */
.ts-bot__log {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--tsx-bg, #f4f5f7);
}

.ts-bot__msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: .92rem;
    line-height: 1.65;
    animation: ts-bot-msg .2s ease both;
}

@keyframes ts-bot-msg {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: none; }
}

.ts-bot__msg--bot {
    align-self: flex-start;
    background: var(--tsx-surface, #fff);
    color: var(--tsx-ink, #14181f);
    border: 1px solid var(--tsx-line, #dcdfe6);
    border-start-start-radius: 4px;
}

.ts-bot__msg--me {
    align-self: flex-end;
    background: var(--tsx-amber, #e9a412);
    color: var(--tsx-night, #16202e);
    font-weight: 600;
    border-start-end-radius: 4px;
}

/* الاقتراحات */
.ts-bot__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
    background: var(--tsx-bg, #f4f5f7);
}
.ts-bot__chips:empty { display: none; }

.ts-bot__chip {
    padding: 7px 13px;
    border: 1px solid var(--tsx-amber, #e9a412);
    border-radius: 999px;
    background: transparent;
    color: var(--tsx-amber-deep, #b87c04);
    font: inherit;
    font-size: .84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.ts-bot__chip:hover {
    background: var(--tsx-amber, #e9a412);
    color: var(--tsx-night, #16202e);
}
.ts-bot__chip--wa {
    border-color: #25d366;
    background: #25d366;
    color: #fff;
}
.ts-bot__chip--wa:hover { background: #1fb857; color: #fff; }

/* خانة الكتابة */
.ts-bot__form {
    display: flex;
    gap: 8px;
    padding: 11px;
    border-top: 1px solid var(--tsx-line, #dcdfe6);
    background: var(--tsx-surface, #fff);
}

.ts-bot__input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--tsx-line, #dcdfe6);
    border-radius: 11px;
    background: var(--tsx-bg, #f4f5f7);
    color: var(--tsx-ink, #14181f);
    font: inherit;
    font-size: .92rem;
}
.ts-bot__input:focus {
    outline: none;
    border-color: var(--tsx-amber, #e9a412);
    box-shadow: 0 0 0 3px rgba(233, 164, 18, .25);
}

.ts-bot__send {
    width: 42px;
    border: 0;
    border-radius: 11px;
    background: var(--tsx-amber, #e9a412);
    color: var(--tsx-night, #16202e);
    font-size: 1.05rem;
    cursor: pointer;
    flex-shrink: 0;
}
.ts-bot__send:hover { filter: brightness(1.06); }

/* على الموبايل: النافذة بتاخد الشاشة كلها تقريباً */
@media (max-width: 480px) {
    .ts-bot { inset-inline: 12px; bottom: 12px; }
    .ts-bot__panel {
        width: 100%;
        height: min(78vh, 560px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-bot__panel,
    .ts-bot__msg { animation: none; }
    .ts-bot__fab:hover { transform: none; }
}
