/* 3TREE AI ASSISTANT V3 - INDEPENDENT STYLES */

#tree-ai-v3 {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999999;
    direction: rtl;
    font-family: Tahoma, Arial, sans-serif;
}

#tree-ai-v3 *,
#tree-ai-v3 *::before,
#tree-ai-v3 *::after {
    box-sizing: border-box;
}

#tree-ai-v3 button,
#tree-ai-v3 textarea {
    font-family: inherit;
}

#tree-ai-v3 .ai3-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 17px;
    border: 1px solid #e5ca8a;
    border-radius: 50px;
    background: linear-gradient(135deg,#b99343,#88621d);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 9px 30px rgba(0,0,0,.25);
    cursor: pointer;
}

#tree-ai-v3 .ai3-launcher svg {
    width: 27px;
    height: 27px;
}

#tree-ai-v3 .ai3-panel {
    position: absolute;
    bottom: 76px;
    left: 0;
    width: 410px;
    max-width: calc(100vw - 30px);
    height: min(610px,calc(100dvh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #c8a45b;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 65px rgba(0,0,0,.3);
}

#tree-ai-v3 .ai3-panel[hidden] {
    display: none !important;
}

#tree-ai-v3 .ai3-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px;
    background: #191919;
    color: #fff;
    flex-shrink: 0;
}

#tree-ai-v3 .ai3-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

#tree-ai-v3 .ai3-avatar {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border-radius: 13px;
    background: #b18a3b;
}

#tree-ai-v3 .ai3-avatar svg {
    width: 28px;
    height: 28px;
}

#tree-ai-v3 .ai3-brand strong {
    display: block;
    font-size: 14px;
    letter-spacing: 1px;
}

#tree-ai-v3 .ai3-brand small {
    display: block;
    margin-top: 5px;
    color: #d5bd88;
    font-size: 11px;
}

#tree-ai-v3 .ai3-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 29px;
    cursor: pointer;
}

#tree-ai-v3 .ai3-tabs {
    display: flex;
    padding: 6px;
    background: #f8f5ee;
    border-bottom: 1px solid #e9dfc8;
    flex-shrink: 0;
}

#tree-ai-v3 .ai3-tabs button {
    flex: 1;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #66583e;
    cursor: pointer;
}

#tree-ai-v3 .ai3-tabs button.active {
    background: #191919;
    color: #e8c782;
}

#tree-ai-v3 .ai3-view {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

#tree-ai-v3 .ai3-view.active {
    display: flex;
}

#tree-ai-v3 .ai3-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    padding: 15px;
}

#tree-ai-v3 .ai3-messages {
    background: #faf8f3;
}

#tree-ai-v3 .ai3-bubble {
    width: fit-content;
    max-width: 90%;
    margin-bottom: 13px;
    padding: 12px 14px;
    border: 1px solid #e7ddc9;
    border-radius: 15px;
    background: #fff;
    color: #292929;
    font-size: 13px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

#tree-ai-v3 .ai3-bubble.user {
    margin-right: auto;
    background: #f1e3c2;
    border-color: #d7bd82;
}

#tree-ai-v3 .ai3-bubble.loading {
    color: #777;
}

#tree-ai-v3 .ai3-chat-products {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

#tree-ai-v3 .ai3-chat-product {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e6d9bd;
    border-radius: 10px;
    background: #fff;
    font-size: 12px;
}

#tree-ai-v3 .ai3-chat-product strong {
    white-space: nowrap;
    color: #9c762e;
}

#tree-ai-v3 .ai3-suggestions {
    display: flex;
    gap: 7px;
    padding: 10px;
    border-top: 1px solid #eee;
}

#tree-ai-v3 .ai3-suggestions button {
    flex: 1;
    padding: 9px;
    border: 1px solid #e2d2ac;
    border-radius: 10px;
    background: #fffaf0;
    font-size: 11px;
    cursor: pointer;
}

#tree-ai-v3 .ai3-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 11px;
    border-top: 1px solid #eee;
}

#tree-ai-v3 .ai3-form textarea {
    flex: 1;
    min-width: 0;
    padding: 11px;
    resize: none;
    border: 1px solid #dcc79c;
    border-radius: 11px;
    font-size: 13px;
    outline-color: #b18a3b;
}

#tree-ai-v3 .ai3-form button {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border: 0;
    border-radius: 11px;
    background: #ae8536;
    color: #fff;
    cursor: pointer;
}

#tree-ai-v3 .ai3-form button svg {
    width: 21px;
    height: 21px;
}

#tree-ai-v3 .ai3-catalog-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #eee;
}

#tree-ai-v3 .ai3-back {
    padding: 7px 10px;
    border: 1px solid #dfcda6;
    border-radius: 8px;
    background: #fffaf0;
    cursor: pointer;
}

#tree-ai-v3 .ai3-catalog-title {
    color: #9d762c;
    font-size: 13px;
}

#tree-ai-v3 .ai3-catalog-content {
    display: grid;
    align-content: start;
    gap: 10px;
    background: #faf8f3;
}

#tree-ai-v3 .ai3-category-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 10px;
    border: 1px solid #e6d8b9;
    border-radius: 12px;
    background: #fff;
    color: #30291d;
    text-align: right;
    font-size: 13px;
    cursor: pointer;
}

#tree-ai-v3 .ai3-category-card:hover {
    border-color: #ae8536;
    background: #fffbf3;
}

#tree-ai-v3 .ai3-category-card img {
    width: 60px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 8px;
    object-fit: cover;
}

#tree-ai-v3 .ai3-product-card {
    display: flex;
    gap: 11px;
    padding: 10px;
    border: 1px solid #e6d8b9;
    border-radius: 12px;
    background: #fff;
}

#tree-ai-v3 .ai3-product-card > img {
    width: 83px;
    height: 83px;
    flex-shrink: 0;
    border-radius: 9px;
    object-fit: cover;
    background: #f3f0e8;
}

#tree-ai-v3 .ai3-product-details {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    font-size: 12px;
}

#tree-ai-v3 .ai3-product-details span {
    color: #9c762e;
    font-weight: bold;
}

#tree-ai-v3 .ai3-product-details a {
    color: #73531c;
    text-decoration: underline;
}

#tree-ai-v3 .ai3-footer {
    padding: 9px;
    border-top: 1px solid #eee;
    background: #fff;
    color: #82755b;
    text-align: center;
    font-size: 10px;
    flex-shrink: 0;
}

@media(max-width:600px) {
    #tree-ai-v3 {
        left: 14px;
        bottom: 14px;
    }

    #tree-ai-v3 .ai3-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 83px;
        width: auto;
        max-width: none;
        height: min(620px,calc(100dvh - 105px));
    }

    #tree-ai-v3 .ai3-launcher-label {
        display: none;
    }

    #tree-ai-v3 .ai3-launcher {
        width: 59px;
        height: 59px;
        justify-content: center;
        padding: 0;
        border-radius: 19px;
    }
}