/**
 * Sale AI Assistant — chat.css (Joor UI v2)
 * THE ONLY source of chat UI styles. Zero inline styles.
 * joor-ai-* prefix | RTL Persian | accent #FF5A1F
 */

/* ════════════════════════════════════════════
   CSS VARIABLES
   ════════════════════════════════════════════ */
.joor-ai-chat-widget {
    --joor-accent:       #FF5A1F;
    --joor-accent-light: rgba(255,90,31,0.12);
    --joor-white:        #FFFFFF;
    --joor-gray-50:      #FCFCFC;
    --joor-gray-100:     #F5F5F5;
    --joor-gray-200:     #EEEEEE;
    --joor-gray-300:     #DDDDDD;
    --joor-gray-500:     #A9A9A9;
    --joor-gray-700:     #666666;
    --joor-gray-900:     #111111;
    --joor-success:      #4CAF50;
    --joor-success-bg:   rgba(76,175,80,0.1);
    --joor-warning:      #FF9800;
    --joor-warning-bg:   rgba(255,152,0,0.12);
    --joor-danger:       #F44336;
    --joor-danger-bg:    rgba(244,67,54,0.1);
    --joor-bubble-bot:   #F1FAFF;
    --joor-bubble-bot-b: #EFEFEF;
    --joor-bubble-usr:   #F4FFF3;
    --joor-bubble-usr-b: #ECF7EA;
    --joor-font:         Vazirmatn, IRANSansX, IRANSans, Tahoma, Arial, sans-serif;
    --joor-font-size:    14px;
    --joor-font-sm:      12px;
    --joor-line-height:  1.9;
    --joor-radius-card:  18px;
    --joor-shadow-card:  0 18px 30px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    --joor-shadow-bbl:   0 1px 5px rgba(0,0,0,.08);
    --joor-shadow-input: 0 0 6px rgba(255,90,31,.4);
}

/* ════════════════════════════════════════════
   WIDGET WRAPPER
   ════════════════════════════════════════════ */
.joor-ai-chat-widget,
.joor-ai-chat-widget * { box-sizing: border-box; }

.joor-ai-chat-widget {
    width:        100%;
    display:      flex;
    justify-content: center;
    align-items:  flex-start;
    font-family:  var(--joor-font);
    font-size:    var(--joor-font-size);
    color:        var(--joor-gray-900);
    direction:    rtl;
    line-height:  normal;
}

/* ════════════════════════════════════════════
   CARD
   ════════════════════════════════════════════ */
.joor-ai-chat-card {
    width:          500px;
    height:         min(817px, 100dvh);
    min-height:     360px;
    background:     var(--joor-white);
    border-radius:  var(--joor-radius-card);
    overflow:       clip;
    box-shadow:     var(--joor-shadow-card);
    border:         1px solid var(--joor-gray-200);
    display:        flex;
    flex-direction: column;
    position:       relative;
    margin:         0;
    padding:        0;
}

/* ════════════════════════════════════════════
   HEADER (flex-shrink 0)
   ════════════════════════════════════════════ */
.joor-ai-chat-header {
    height: 72px;
    flex: 0 0 72px;
    background: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    direction: rtl;
    margin: 0;
}

.joor-ai-header-title {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    color: #111111;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}


/* ── Select wrapper ── */
.joor-ai-select-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    width: 100%;
    z-index: 20;
}

/* Native select is preserved for the original program logic. */
.joor-ai-assistant-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.joor-ai-custom-select-trigger {
    width: 100%;
    height: 42px;
    border: 1px solid #dddddd;
    border-radius: 9px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-family: var(--joor-font);
    font-size: 14px;
    color: #111111;
    background: #ffffff;
    cursor: pointer;
    direction: rtl;
    text-align: right;
    outline: none;
    margin: 0;
    box-shadow: none;
    overflow: visible;
}

.joor-ai-custom-select-trigger:hover {
    border-color: #c8c8c8;
}

.joor-ai-custom-select-trigger[aria-expanded="true"] {
    border-color: #dddddd;
    border-radius: 9px 9px 0 0;
}

.joor-ai-custom-selected-text {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.joor-ai-custom-selected-text strong {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
    color: #111111;
    white-space: nowrap;
}

.joor-ai-custom-selected-text span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    color: #111111;
    white-space: nowrap;
}

.joor-ai-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    pointer-events: none;
    display: block;
    transition: transform .18s ease;
}

.joor-ai-custom-select-trigger[aria-expanded="true"] .joor-ai-chevron {
    transform: rotate(180deg);
}

.joor-ai-custom-options {
    position: absolute;
    top: calc(100% - 1px);
    right: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    z-index: 50;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-top: 0;
    border-radius: 0 0 9px 9px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .10);
}

.joor-ai-custom-options[hidden] {
    display: none;
}

.joor-ai-custom-option {
    width: 100%;
    height: 42px;
    min-height: 42px;
    border: 0;
    border-radius: 0;
    padding: 0 14px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    background: #ffffff;
    color: #111111;
    font-family: var(--joor-font);
    direction: rtl;
    text-align: right;
    cursor: pointer;
    outline: none;
}

.joor-ai-custom-option:hover,
.joor-ai-custom-option:focus-visible {
    background: #dddddd;
}

.joor-ai-custom-option strong {
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    color: #111111;
    white-space: nowrap;
}

.joor-ai-custom-option span {
    min-width: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #111111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The current assistant remains visible in the trigger, not repeated in the list. */
.joor-ai-custom-option.is-active,
.joor-ai-custom-option[hidden] {
    display: none;
}

/* ── Avatar ── */
.joor-ai-avatar {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #e2e2e2;
    overflow: hidden;
    background: #f5f5f5;
    margin-right: auto;
}

.joor-ai-avatar img {
    width:      100%;
    height:     100%;
    display:    block;
    object-fit: cover;
    border:     0;
    margin:     0;
    padding:    0;
}

/* ════════════════════════════════════════════
   ORANGE DIVIDER
   ════════════════════════════════════════════ */
.joor-ai-orange-line {
    flex:       0 0 5px;
    height:     5px;
    background: var(--joor-accent);
    width:      100%;
    margin:     0;
    padding:    0;
}

/* ════════════════════════════════════════════
   CHAT BODY (scrollable flex-1)
   ════════════════════════════════════════════ */
.joor-ai-chat-body {
    flex:               1 1 auto;
    min-height:         0;
    overflow-y:         auto;
    padding:            19px 17px 19px 15px;
    background-color:   var(--joor-gray-50);
    background-image:   var(--joor-chat-bg, none);
    background-size:    cover;
    background-position: center;
    background-repeat:  repeat;
    display:            flex;
    flex-direction:     column;
    gap:                15px;
    scroll-behavior:    smooth;
    direction:          rtl;
}

.joor-ai-chat-body > * {
    flex-shrink: 0;
}

.joor-ai-chat-body[hidden] { display: none; }

.joor-ai-chat-body::-webkit-scrollbar       { width: 4px; }
.joor-ai-chat-body::-webkit-scrollbar-track { background: transparent; }
.joor-ai-chat-body::-webkit-scrollbar-thumb { background: var(--joor-gray-300); border-radius: 4px; }

/* ════════════════════════════════════════════
   TYPING INDICATOR
   ════════════════════════════════════════════ */
.joor-ai-typing-indicator {
    display:       flex;
    align-items:   flex-end;
    gap:           5px;
    padding:       10px 16px;
    align-self:    flex-end;
    order:         9999;
    background:    var(--joor-bubble-bot);
    border:        1px solid var(--joor-bubble-bot-b);
    border-radius: 17px;
    border-bottom-left-radius: 6px;
    box-shadow:    var(--joor-shadow-bbl);
    width:         fit-content;
}

.joor-ai-typing-indicator[hidden] { display: none; }

.joor-ai-typing-indicator span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--joor-accent); opacity: .6;
    animation: joor-bounce 1.2s infinite ease-in-out;
}
.joor-ai-typing-indicator span:nth-child(1) { animation-delay: 0s; }
.joor-ai-typing-indicator span:nth-child(2) { animation-delay: .2s; }
.joor-ai-typing-indicator span:nth-child(3) { animation-delay: .4s; }

@keyframes joor-bounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-6px); }
}

/* ════════════════════════════════════════════
   MESSAGE BUBBLES
   ════════════════════════════════════════════ */
.saa-message {
    display:   flex;
    max-width: 78%;
    animation: joor-fade 0.22s ease;
}

@keyframes joor-fade {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.saa-message.user      { align-self: flex-start; flex-direction: row-reverse; }
.saa-message.assistant { align-self: flex-end; }

.saa-message__bubble {
    padding:       9px 18px 10px;
    border-radius: 17px;
    font-size:     var(--joor-font-size);
    line-height:   var(--joor-line-height);
    word-break:    break-word;
    white-space:   pre-wrap;
    box-shadow:    var(--joor-shadow-bbl);
    direction:     rtl;
    text-align:    right;
}

.saa-message.user .saa-message__bubble {
    background:               var(--joor-bubble-usr);
    border:                   1px solid var(--joor-bubble-usr-b);
    border-bottom-right-radius: 6px;
    max-width:                325px;
}

.saa-message.assistant .saa-message__bubble {
    background:              var(--joor-bubble-bot);
    border:                  1px solid var(--joor-bubble-bot-b);
    border-bottom-left-radius: 6px;
    max-width:               280px;
}

.saa-message.assistant .saa-message__bubble a { color: var(--joor-accent); text-decoration: underline; }
.saa-message.assistant .saa-message__bubble a:hover { color: #cc4810; }

/* ════════════════════════════════════════════
   ACCESS PANELS
   ════════════════════════════════════════════ */
.joor-ai-access-panel {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             16px;
    padding:         40px 24px;
    background:      var(--joor-gray-50);
    text-align:      center;
    flex:            1 1 auto;
}
.joor-ai-access-panel[hidden] { display: none; }
.joor-ai-access-text     { color: var(--joor-gray-700); margin: 0; }
.joor-ai-access-emphasis { color: var(--joor-gray-900); font-size: 16px; font-weight: 700; margin: 0; }

/* ════════════════════════════════════════════
   ERROR PANEL
   ════════════════════════════════════════════ */
.joor-ai-error-panel {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             12px;
    padding:         40px 24px;
    background:      var(--joor-danger-bg);
    text-align:      center;
    flex:            1 1 auto;
}
.joor-ai-error-panel[hidden] { display: none; }
.joor-ai-error-text    { color: var(--joor-danger); font-size: 16px; font-weight: 600; margin: 0; }
.joor-ai-error-sub     { color: var(--joor-gray-700); margin: 0; }
.joor-ai-error-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════ */
.joor-ai-btn-primary,
.joor-ai-btn-secondary {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    padding:         10px 22px;
    border:          none;
    border-radius:   10px;
    font-family:     var(--joor-font);
    font-size:       var(--joor-font-size);
    font-weight:     600;
    cursor:          pointer;
    text-decoration: none;
    transition:      opacity .15s;
    white-space:     nowrap;
}
.joor-ai-btn-primary  { background: var(--joor-accent); color: var(--joor-white); }
.joor-ai-btn-secondary { background: var(--joor-white); color: var(--joor-gray-900); border: 1.5px solid var(--joor-gray-300); }
.joor-ai-btn-primary:hover,
.joor-ai-btn-secondary:hover { opacity: .85; }

/* ════════════════════════════════════════════
   FOOTER / INPUT (flex-shrink 0)
   ════════════════════════════════════════════ */
.joor-ai-chat-footer {
    flex:       0 0 auto;
    min-height: 91px;
    height:     auto;
    background: var(--joor-white);
    padding:    17px 15px 11px;
    margin:     0;
}
.joor-ai-chat-footer[hidden] { display: none; }

.joor-ai-input-box {
    width:         100%;
    min-height:    63px;
    height:        auto;
    border:        2px solid var(--joor-accent);
    border-radius: 11px;
    display:       flex;
    align-items:   center;
    direction:     rtl;
    background:    var(--joor-white);
    overflow:      hidden;
    box-shadow:    var(--joor-shadow-input);
    margin:        0;
    padding:       0;
}

/* Send button */
.joor-ai-send-btn {
    width:          50px;
    height:         50px;
    min-width:      50px;
    flex:           0 0 50px;
    border:         0;
    outline:        0;
    border-radius:  50%;
    background:     transparent;
    padding:        0;
    margin:         0 7px 6px 0;
    display:        flex;
    align-items:    center;
    justify-content: center;
    cursor:         pointer;
    appearance:     none;
    -webkit-appearance: none;
}
.joor-ai-send-btn img { width: 50px; height: 50px; display: block; border: 0; margin: 0; padding: 0; }
.joor-ai-send-btn:hover    { opacity: .88; }
.joor-ai-send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Input wrapper + placeholder overlay */
.joor-ai-input-wrap {
    flex:     1;
    position: relative;
    min-height: 63px;
    height:   auto;
    display:  flex;
    align-items: flex-end;
    overflow: hidden;
}

.joor-ai-placeholder {
    position:   absolute;
    inset:      0;
    display:    flex;
    align-items: center;
    justify-content: flex-start;
    padding:    0 22px 0 0;
    color:      #a9a9a9;
    font-size:  14px;
    font-family: var(--joor-font);
    direction:  rtl;
    text-align: right;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity .1s;
}

.joor-ai-placeholder.hidden { display: none; }

/* Textarea — covers entire wrap, invisible native */
.joor-ai-input {
    position:   relative;
    inset:      auto;
    width:      100%;
    min-height: 63px;
    height:     63px;
    border:     0;
    outline:    0;
    background: transparent;
    font-family: var(--joor-font);
    font-size:  14px;
    color:      #111;
    resize:     none;
    overflow-y: hidden;
    direction:  rtl;
    text-align: right;
    padding:    20px 22px 20px 12px;
    line-height: 22px;
    box-sizing: border-box;
    margin:     0;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
.joor-ai-input {
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd transparent;
}
.joor-ai-input::-webkit-scrollbar {
    width: 5px;
}
.joor-ai-input::-webkit-scrollbar-track { background: transparent; }
.joor-ai-input::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 10px;
}
.joor-ai-input::placeholder        { color: transparent; }

/* Attach button */
.joor-ai-attach-btn {
    width:          44px;
    height:         44px;
    min-width:      44px;
    flex:           0 0 44px;
    border:         0;
    outline:        0;
    background:     transparent;
    padding:        0;
    margin:         0 0 6px 8px;
    display:        flex;
    align-items:    center;
    justify-content: center;
    cursor:         pointer;
    appearance:     none;
    -webkit-appearance: none;
    box-shadow:     none;
}
.joor-ai-attach-btn img { width: 28px; height: 28px; display: block; border: 0; margin: 0; padding: 0; }
.joor-ai-attach-btn:hover { opacity: .75; }
.joor-ai-attach-btn[hidden] { display: none !important; }
.saa-attachment-input { display: none !important; }

.saa-attachment-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--joor-gray-200);
    border-radius: 10px;
    background: var(--joor-white);
}
.saa-attachment-preview img {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--joor-gray-200);
}
.saa-attachment-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--joor-gray-900);
}
.saa-attachment-meta strong { overflow-wrap: anywhere; }
.saa-attachment-meta span { font-size: 12px; color: var(--joor-gray-600); }
.saa-attachment-remove {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 0;
    border-radius: 50%;
    background: var(--joor-gray-100);
    color: var(--joor-gray-900);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.saa-attachment-error {
    align-self: stretch;
    direction: rtl;
    padding: 10px 12px;
    border: 1px solid #dc2626;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
}

/* ════════════════════════════════════════════
   PRODUCT CARDS
   ════════════════════════════════════════════ */
.saa-product-cards-container {
    display:    flex;
    flex-direction: row;
    gap:        12px;
    flex-wrap:  nowrap;
    overflow-x: auto;
    padding:    4px 0 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    align-self: stretch;
    flex: 0 0 auto;
}
.saa-product-card {
    flex:           0 0 200px;
    background:     var(--joor-white);
    border:         1px solid var(--joor-gray-200);
    border-radius:  12px;
    overflow:       hidden;
    box-shadow:     var(--joor-shadow-bubble);
    transition:     box-shadow 0.2s, transform 0.2s;
    display:        flex;
    flex-direction: column;
}
.saa-product-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.12); transform: translateY(-2px); }
.saa-product-card-image { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--joor-gray-100); }
.saa-product-card-body {
    padding:        10px 12px;
    flex:           1;
    display:        flex;
    flex-direction: column;
    gap:            6px;
}
.saa-product-card-title {
    font-size:   var(--joor-font-size);
    font-weight: 600;
    color:       var(--joor-gray-900);
    line-height: 1.4;
    display:     -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:    hidden;
}
.saa-product-card-price         { font-size: var(--joor-font-size-sm); color: var(--joor-gray-700); }
.saa-product-card-price.has-sale .regular-price { text-decoration: line-through; color: var(--joor-gray-500); font-size: 11px; }
.saa-product-card-price.has-sale .sale-price    { color: var(--joor-danger); font-weight: 600; }
.saa-product-card-stock         { font-size: var(--joor-font-size-sm); font-weight: 500; }
.saa-product-card-stock.instock    { color: var(--joor-success); }
.saa-product-card-stock.outofstock { color: var(--joor-danger); }
.saa-product-card-reason { font-size: var(--joor-font-size-sm); color: var(--joor-gray-500); font-style: italic; line-height: 1.4; }
.saa-product-card-actions {
    margin-top: auto;
}
.saa-product-card-btn {
    display:     block;
    width:       100%;
    box-sizing:  border-box;
    text-align:  center;
    color:       var(--joor-white);
    text-decoration: none;
    padding:     9px 12px;
    font-size:   var(--joor-font-size-sm);
    font-weight: 600;
    transition:  opacity 0.15s;
}
.saa-product-card-add-btn {
    background: var(--joor-accent);
}
.saa-product-card-view-btn {
    background: var(--joor-gray-500);
    border-radius: 0 0 12px 12px;
}
.saa-product-card-btn:hover { opacity: 0.88; color: var(--joor-white); text-decoration: none; }

/* ════════════════════════════════════════════
   HANDOFF PANEL
   ════════════════════════════════════════════ */
.saa-handoff-panel {
    background:    var(--joor-warning-bg);
    border:        1px solid var(--joor-warning);
    border-radius: 12px;
    padding:       16px;
    align-self:    stretch;
    direction:     rtl;
}
.saa-handoff-panel.danger { background: var(--joor-danger-bg); border-color: var(--joor-danger); }
.saa-handoff-title        { font-size: 15px; font-weight: 600; color: var(--joor-gray-900); margin-bottom: 10px; }
.saa-handoff-actions      { display: flex; flex-wrap: wrap; gap: 4px; }

.saa-contact-btn {
    display:     inline-flex;
    align-items: center;
    gap:         8px;
    padding:     10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    font-size:   var(--joor-font-size);
    transition:  opacity .15s;
    margin:      4px;
}
.saa-contact-btn:hover         { opacity: .85; text-decoration: none; }
.saa-contact-btn-phone         { background: var(--joor-accent); color: var(--joor-white); }
.saa-contact-btn-whatsapp      { background: #25D366; color: var(--joor-white); }
.saa-contact-btn-page          { background: var(--joor-gray-200); color: var(--joor-gray-900); }

/* ════════════════════════════════════════════
   TICKET FORM
   ════════════════════════════════════════════ */
.saa-ticket-form-container {
    background:    var(--joor-gray-50);
    border:        1px solid var(--joor-gray-200);
    border-radius: 12px;
    padding:       16px;
    align-self:    stretch;
    direction:     rtl;
}
.saa-ticket-form-title { font-size: 15px; font-weight: 600; color: var(--joor-gray-900); margin-bottom: 12px; display: block; }

.saa-ticket-field {
    width:         100%;
    padding:       10px 12px;
    border:        1.5px solid var(--joor-gray-300);
    border-radius: 8px;
    font-size:     var(--joor-font-size);
    font-family:   var(--joor-font);
    margin-bottom: 10px;
    direction:     rtl;
    box-sizing:    border-box;
    transition:    border-color .2s, box-shadow .2s;
    background:    var(--joor-white);
    color:         var(--joor-gray-900);
}
.saa-ticket-field:focus { outline: none; border-color: var(--joor-accent); box-shadow: 0 0 0 3px var(--joor-accent-light); }

.saa-ticket-submit-btn {
    background:  var(--joor-accent);
    color:       var(--joor-white);
    border:      none;
    padding:     10px 24px;
    border-radius: 10px;
    font-size:   var(--joor-font-size);
    font-weight: 600;
    cursor:      pointer;
    font-family: var(--joor-font);
    transition:  opacity .15s;
}
.saa-ticket-submit-btn:hover    { opacity: .88; }
.saa-ticket-submit-btn:disabled { opacity: .5; cursor: not-allowed; }

.saa-ticket-success {
    background:  var(--joor-success-bg);
    color:       var(--joor-success);
    border:      1px solid var(--joor-success);
    border-radius: 8px;
    padding:     12px;
    text-align:  center;
    font-weight: 600;
}

/* ════════════════════════════════════════════
   FEEDBACK ROW
   ════════════════════════════════════════════ */
.saa-feedback-row {
    display:    flex;
    align-items: center;
    gap:        8px;
    flex-wrap:  wrap;
    align-self: flex-end;
    direction:  rtl;
}
.saa-feedback-label { font-size: var(--joor-font-sm); color: var(--joor-gray-500); }
.saa-feedback-btn {
    background:  none;
    border:      1px solid var(--joor-gray-300);
    border-radius: 8px;
    padding:     4px 10px;
    cursor:      pointer;
    font-size:   16px;
    font-family: var(--joor-font);
    line-height: 1;
    transition:  background .15s, border-color .15s;
}
.saa-feedback-btn:hover { background: var(--joor-gray-100); border-color: var(--joor-accent); }
.saa-feedback-thanks    { font-size: var(--joor-font-sm); color: var(--joor-success); }

/* ════════════════════════════════════════════
   RATE LIMIT MESSAGE
   ════════════════════════════════════════════ */
.saa-message.rate-limit .saa-message__bubble {
    background: var(--joor-warning-bg);
    border:     1px solid var(--joor-warning);
    color:      var(--joor-gray-900);
}

/* ════════════════════════════════════════════
   WARNING / DANGER BOX
   ════════════════════════════════════════════ */
.saa-warning-box {
    padding:       12px 16px;
    background:    var(--joor-warning-bg);
    border:        1px solid var(--joor-warning);
    border-radius: 12px;
    color:         var(--joor-gray-900);
    font-size:     var(--joor-font-sm);
    align-self:    stretch;
    direction:     rtl;
}
.saa-warning-box.level-danger {
    border-right:  4px solid var(--joor-danger);
    background:    var(--joor-danger-bg);
    border-color:  var(--joor-danger);
}

/* ════════════════════════════════════════════
   MOBILE (max-width: 560px)
   ════════════════════════════════════════════ */
@media (max-width: 560px) {
    .joor-ai-chat-card   { width: 100%; max-width: 500px; border-radius: var(--joor-radius-card); }
    .joor-ai-chat-header { padding: 0 14px; gap: 12px; }
    .saa-message.user .saa-message__bubble      { max-width: min(325px, 78%); }
    .saa-message.assistant .saa-message__bubble { max-width: min(280px, 72%); }
    .joor-ai-custom-selected-text { gap: 10px; }
    .joor-ai-custom-option {
        grid-template-columns: 52px minmax(0, 1fr);
        column-gap: 10px;
        padding: 0 14px;
    }
    .joor-ai-error-actions { flex-direction: column; }
    .joor-ai-btn-primary,
    .joor-ai-btn-secondary { width: 100%; }
}

/* Assistant routing button — shown only when the AI explicitly delegates to another assistant. */
.saa-assistant-switch-button {
    align-self: flex-end;
    margin: 8px 16px 14px;
    padding: 10px 18px;
    border: 1px solid var(--joor-accent, #ff5a1f);
    border-radius: 10px;
    background: #fff;
    color: var(--joor-accent, #ff5a1f);
    font: inherit;
    cursor: pointer;
}
.saa-assistant-switch-button:hover {
    background: var(--joor-accent, #ff5a1f);
    color: #fff;
}

/* Responsive viewport fit: keeps the chat above any fixed bottom bar. */
.joor-ai-chat-card {
    height: min(817px, var(--joor-chat-available-height, 100dvh));
    min-height: min(360px, var(--joor-chat-available-height, 360px));
}
