:root {
    --epharm-ai-primary: #df7e12;
    --epharm-ai-primary-dark: #1b54a5;

    --epharm-ai-text: #20242a;
    --epharm-ai-muted: #727983;

    --epharm-ai-border: #e5e8ec;
    --epharm-ai-background: #ffffff;
    --epharm-ai-soft: #f5f7fa;
    --epharm-ai-promo: #d84f19;


    --epharm-ai-success: #15855c;
    --epharm-ai-danger: #c92b3f;
    --epharm-ai-button: #3F6473;
    --epharm-ai-button-hover: #3F6473;
    --epharm-ai-message: #5E8291;

    --epharm-ai-radius: 5px;

    --epharm-ai-shadow:
        0 18px 55px rgba(20, 31, 50, .17);
}





.epharm-ai-chat,
.epharm-ai-chat * {
    box-sizing: border-box;
}


.epharm-ai-chat {
    position: fixed;

    right: 22px;
    bottom: 22px;

    z-index: 1;

    font-family: inherit;

    color:
        var(--epharm-ai-text);
}


/* ==========================================================
   LAUNCHER
   ========================================================== */

.epharm-ai-launcher {
    width: 60px;
    height: 60px;

    border: 0;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    cursor: pointer;

    background:
        var(--epharm-ai-button);

    color: #fff;

    box-shadow: 4px 5px 8px rgba(28, 82, 160, .28);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        background .18s ease;

    -webkit-tap-highlight-color:
        transparent;
        gap: 10px;
}


.epharm-ai-launcher:hover {
    transform:
        translateY(-2px);

    background:
        var(--epharm-ai-button-hover);

    box-shadow: 3px 6px 8px rgba(28, 82, 160, .34);
}


.epharm-ai-launcher:focus-visible {
    outline:
        3px solid rgba(36, 104, 201, .25);

    outline-offset:
        4px;
}





.epharm-ai-launcher-icon {
    display: flex;
}


/* =========================================================
   LIST
   ========================================================= */

.epharm-ai-products {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;

    width: 100%;

    margin-top: 10px;
}


/* =========================================================
   CARD
   ========================================================= */

.epharm-ai-product-card {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;

    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    align-items: center;

    padding: 5px;

    background: #ffffff;

    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;

    border: 1px solid #e1e1e1;

    color: #282828;

    overflow: hidden;
    position: relative;

    transition:
        box-shadow .2s ease-in-out,
        border-color .2s ease-in-out;
}


.epharm-ai-product-card:hover {
    box-shadow: 0 2px 5px 3px #41414112;
}


.epharm-ai-product-card:focus-visible {
    outline: 2px solid #df7e12;
    outline-offset: 2px;
}


/* =========================================================
   IMAGE — LEFT
   ========================================================= */

.epharm-ai-product-media {
    width: 86px;
    height: 86px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #ffffff;
}


.epharm-ai-product-image {
    display: block;

    width: 100px;
    height: 100px;

    object-fit: contain;

    background: #ffffff;
}



/* =========================================================
   CONTENT — RIGHT
   ========================================================= */

.epharm-ai-product-body {
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-self: stretch;

    padding: 2px 0;
}


/* Brand */
.epharm-ai-product-brand {
    margin: 0 0 4px;

    font-size: 0.72rem;
    line-height: 1.2;
    font-weight: 600;

    color: #676968;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Product name */
.epharm-ai-product-name {
    min-width: 0;

    font-size: 0.88rem;
    line-height: 1.25;
    font-weight: 400;

    color: #282828;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    line-clamp: 2;

    overflow: hidden;
}


/* =========================================================
   PRICE
   ========================================================= */

.epharm-ai-product-text-link {
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.epharm-ai-product-text-link:hover .epharm-ai-product-name {
    color: var(--epharm-ai-primary);
}

.epharm-ai-product-variant {
    margin-top: 4px;
    color: var(--epharm-ai-muted);
    font-size: 0.68rem;
    line-height: 1.25;
    font-weight: 600;
}

.epharm-ai-product-price-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 7px;

    min-height: 36px;

    margin-top: auto;
    padding-top: 8px;
}

.epharm-ai-product-prices {
    min-width: 0;

    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
}

.epharm-ai-chat
.epharm-ai-product-price-row
button.btn.btn-primary.epharm-ai-product-cart-button {
    position: static !important;

    right: auto !important;
    bottom: auto !important;

    width: 36px !important;
    min-width: 36px;
    height: 34px !important;

    margin: 0 0 0 auto;
    padding: 0 !important;

    flex: 0 0 36px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 5px;

    background: var(--epharm-ai-primary);
    color: #fff;

    cursor: pointer;

    transition:
        background .15s ease,
        opacity .15s ease;
}

.epharm-ai-chat
.epharm-ai-product-price-row
button.btn.btn-primary.epharm-ai-product-cart-button:hover {
    background: var(--epharm-ai-promo);
}

.epharm-ai-chat
.epharm-ai-product-price-row
button.btn.btn-primary.epharm-ai-product-cart-button svg {
    width: 19px;
    height: 19px;

    color: #fff;
    fill: currentColor;

    pointer-events: none;
}


.epharm-ai-product-old-price {
    font-size: 0.78rem;
    line-height: 1;

    color: #8a8a8a;

    text-decoration: line-through;
}


.epharm-ai-product-price {
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 600;

    color: #282828;
}


.epharm-ai-product-promo {
    display: inline-flex;
    align-items: center;

    padding: 2px 5px;

    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;

    background: #fff3e5;

    color: #d84f19;

    font-size: 0.65rem;
    line-height: 1.2;
    font-weight: 700;
}


/*
 * Цялото каре е линк.
 * Старият текст "Виж продукта" не е необходим.
 */
.epharm-ai-product-action {
    display: none;
}



/* ==========================================================
   PANEL
   ========================================================== */

.epharm-ai-panel {
    position: absolute;

    right: 0;
    bottom: 10px;

    width: 410px;
    height: min(660px, calc(100vh - 125px));

    min-height: 470px;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    border:
        1px solid var(--epharm-ai-border);

    border-radius:
        var(--epharm-ai-radius);

    background:
        var(--epharm-ai-background);

    box-shadow:
        var(--epharm-ai-shadow);

    transform-origin:
        bottom right;

    animation:
        epharm-ai-open .18s ease-out;
}


.epharm-ai-panel[hidden] {
    display: none !important;
}


@keyframes epharm-ai-open {
    from {
        opacity: 0;

        transform:
            translateY(10px) scale(.98);
    }

    to {
        opacity: 1;

        transform:
            translateY(0) scale(1);
    }
}


/* ==========================================================
   HEADER
   ========================================================== */

.epharm-ai-header {
    min-height: 50px;

    padding: 5px 12px;
    line-height: 1;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    border-bottom:
        1px solid var(--epharm-ai-border);

    background: var(--epharm-ai-button);

    flex-shrink: 0;
    color:
        var(--epharm-ai-background);
}


.epharm-ai-header-brand {
    display: flex;
    align-items: center;

    min-width: 0;

    gap: 10px;
}


.epharm-ai-avatar {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        var(--epharm-ai-primary);

    color: #fff;

    font-size: 13px;
    font-weight: 800;
}


.epharm-ai-header-text {
    min-width: 0;
}


.epharm-ai-title {
    font-size: 15px;
    font-weight: 700;

    line-height: 1.25;
}




.epharm-ai-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color:#fff;
    background:transparent;
    transition:
        background .15s ease;
}

.epharm-ai-close svg {
    width: 20px;
}


.epharm-ai-close:hover {
    background:
        var(--epharm-ai-soft);
   color:
        var(--epharm-ai-button);
}


/* ==========================================================
   MESSAGES
   ========================================================== */

.epharm-ai-messages {
    flex: 1 1 auto;

    overflow-y: auto;
    overflow-x: hidden;

    padding:
        18px 15px;

    background:
        #f7f8fa;

    scroll-behavior:
        smooth;

    overscroll-behavior:
        contain;
}


.epharm-ai-message-row {
    width: 100%;

    display: flex;

    margin-bottom:
        12px;


}


.epharm-ai-message-row--assistant {
    justify-content:
        flex-start;

    align-items:
        flex-start;

    flex-direction: column;
}


.epharm-ai-message-row--user {
    justify-content:
        flex-end;
}


.epharm-ai-message-label {
    margin: 0 0 2px 10px;

    color:
        var(--epharm-ai-button);

    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
}


.epharm-ai-message {
    max-width: 84%;

    padding:
        10px 13px;

    border-radius: 10px;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

}


.epharm-ai-message-row--assistant .epharm-ai-message {
    background: #fff;

    border:
        1px solid var(--epharm-ai-border);

    border-bottom-left-radius: 0px;
}


.epharm-ai-message-row--user .epharm-ai-message {
    background:
        var(--epharm-ai-message);

    color: #fff;

    border-bottom-right-radius:
        0px;
}


/* ==========================================================
   TYPING
   ========================================================== */

.epharm-ai-typing {
    min-width: 54px;

    display: flex;

    justify-content:
        center;

    gap: 5px;
}


.epharm-ai-typing-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background:
        #949aa2;

    animation:
        epharm-ai-dot 1.15s infinite ease-in-out;
}


.epharm-ai-typing-dot:nth-child(2) {
    animation-delay:
        .14s;
}


.epharm-ai-typing-dot:nth-child(3) {
    animation-delay:
        .28s;
}


@keyframes epharm-ai-dot {

    0%,
    60%,
    100% {
        opacity: .4;

        transform:
            translateY(0);
    }

    30% {
        opacity: 1;

        transform:
            translateY(-3px);
    }
}


/* ==========================================================
   PRODUCT CARDS
   ========================================================== */

.epharm-ai-products {
    width: 100%;

    margin-top: 8px;

    display: grid;

    gap: 8px;
}







.epharm-ai-product-brand {
    margin-bottom: 3px;

    color:
        var(--epharm-ai-muted);

    font-size: 11px;
    font-weight: 600;

    text-transform:
        uppercase;

    letter-spacing:
        .02em;
}


.epharm-ai-product-name {
    display:
        -webkit-box;

    overflow:
        hidden;

    -webkit-box-orient:
        vertical;

    -webkit-line-clamp:
        2;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.4;
}



.epharm-ai-product-price {
    color:
        var(--epharm-ai-promo);

    font-size: 16px;
    font-weight: 700;
}


.epharm-ai-product-old-price {
    color: #9298a1;

    font-size: 12px;

    text-decoration:
        line-through;
}


.epharm-ai-product-promo {
    padding:
        3px 6px;

    border-radius:
        5px;

    background:
        #e8f6ee;

    color:
        var(--epharm-ai-success);

    font-size: 10px;
    font-weight: 700;

    text-transform:
        uppercase;
    display: none;
}


.epharm-ai-product-action {
    margin-top: 7px;

    color:
        var(--epharm-ai-primary);

    font-size: 12px;
    font-weight: 700;
}


/* ==========================================================
   STATUS
   ========================================================== */

.epharm-ai-status {
    min-height: 0;

    padding:
        0 14px;

    font-size: 12px;

    color:
        var(--epharm-ai-muted);

    background: #fff;
}


.epharm-ai-status:not(:empty) {
    padding-top: 7px;
}


.epharm-ai-status.is-error {
    color:
        var(--epharm-ai-danger);
}


/* ==========================================================
   INPUT
   ========================================================== */

.epharm-ai-form {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    border-top: 1px solid var(--epharm-ai-border);
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 5px #e1e1e1;
}


.epharm-ai-input {
    width: 100%;
    border:1px solid #d8dde3;
    border-radius: 5px;
    outline: none;
    background: #fff;
    font: inherit;
    line-height: 1.2;
    resize: none;
    outline: none;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 14px 10px 10px;
    box-sizing: border-box;
    resize: none;
    border: none;
    max-height: 50px;

}


.epharm-ai-input:focus {
    border-color:
        var(--epharm-ai-primary);

   
}


.epharm-ai-input::placeholder {
    color: #9ba1a9;
}


.epharm-ai-input:disabled {
    opacity: .65;
}


.epharm-ai-send {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    background:var(--epharm-ai-primary);
    color: #fff;
    transition:
        background .15s ease,
        opacity .15s ease;
    margin: 5px;
}


.epharm-ai-send:hover {
    background:
        var(--epharm-ai-promo);
}


.epharm-ai-send:disabled {
    cursor: default;

    opacity: .5;
}


/* ==========================================================
   DISCLAIMER
   ========================================================== */

.epharm-ai-disclaimer {
    padding: 2px 5px;
    background: #fff;
    color:#c1c1c1;
    font-size: 0.7rem;
    line-height: 1.3;
    flex-shrink: 0;
}


/* ==========================================================
   ACCESSIBILITY
   ========================================================== */

.epharm-ai-visually-hidden {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;

    clip:
        rect(0, 0, 0, 0) !important;

    white-space: nowrap !important;

    border: 0 !important;
}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 600px) {

    html.epharm-ai-chat-open {
        overflow: hidden;
    }


    .epharm-ai-chat {
        right: 14px;
        bottom: 14px;
    }


    .epharm-ai-panel {
        position: fixed;

        left: 0;
        top: 0;
        right: 0;
        bottom: 0;

        width: 100vw;

        height: 100dvh;

        min-height: 0;

        border: 0;
        border-radius: 0;

        box-shadow: none;
    }


    .epharm-ai-chat.is-open .epharm-ai-launcher {
        display: none;
    }


    .epharm-ai-header {
        padding-top:
            max(11px,
                env(safe-area-inset-top));
    }


    .epharm-ai-messages {
        padding:
            15px 12px;
    }


    .epharm-ai-message {
        max-width: 88%;
    }


 
}

@media only screen and (max-width: 600px) {
    .epharm-ai-products {
        gap: 7px;
    }


    .epharm-ai-product-card {
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 10px;
        padding: 9px;
    }


    .epharm-ai-product-media {
        width: 76px;
        height: 76px;
    }


    .epharm-ai-product-name {
        font-size: 0.84rem;
    }


    .epharm-ai-product-price {
        font-size: 1.08rem;
    }
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    .epharm-ai-panel,
    .epharm-ai-launcher,
    .epharm-ai-product-card {
        animation: none;
        transition: none;
    }


    .epharm-ai-messages {
        scroll-behavior: auto;
    }
}