/* RealOffice AI plugin (סוכני בינה של RealOffice בתוך Webtiv2) */

.roai-hidden { display: none !important; }

/* Card toolbar button */
#btnRoaiAi {
    height: 25px;
    margin-top: 3px;
    margin-left: 5px;
    margin-right: 5px;
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 600;
}
#btnRoaiAi:hover { filter: brightness(1.08); }
#btnRoaiAi .caret {
    margin-right: 5px;
    border-top-color: #fff;
}
.roai-toolbar-menu {
    position: relative;
}
.roai-ai-dropdown {
    right: 5px;
    left: auto;
    min-width: 230px;
    margin-top: 2px;
    padding: 6px;
    direction: rtl;
    border: 1px solid #dbe3f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(30, 41, 59, 0.2);
    z-index: 1100;
}
.roai-menu-primary-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.roai-menu-primary-row .roai-marketing-link {
    flex: 1;
}
.roai-menu-primary-row #btnRoaiAdmin {
    flex: 0 0 auto;
    border-right: 1px solid #e4e7f2;
}
.roai-ai-dropdown > li > a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 7px;
    color: #26364d;
    font-weight: 600;
    text-align: right;
}
.roai-ai-dropdown > li > a:hover,
.roai-ai-dropdown > li > a:focus {
    color: #4438c8;
    background: #f0efff;
}
.roai-ai-dropdown > li > a > i {
    width: 18px;
    color: #5d52e8;
    text-align: center;
}

/* Overlay + dialog */
.roai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 40, 0.45);
    z-index: 1035; /* above page chrome, below Webtiv's #ExtraPanel (1040+) */
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: "Heebo", "Arimo", Arial, sans-serif;
}
.roai-dialog {
    width: min(920px, 94vw);
    height: min(720px, 90vh);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.roai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%);
    color: #fff;
}
.roai-header .roai-title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; }
.roai-header .roai-subtitle { font-size: 12px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roai-header button.roai-icon-btn {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    line-height: 30px;
    padding: 0;
}
.roai-header button.roai-icon-btn:hover { background: rgba(255, 255, 255, 0.32); }
.roai-header button.roai-text-btn {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    padding: 0 10px;
    white-space: nowrap;
}
.roai-header button.roai-text-btn:hover { background: rgba(255, 255, 255, 0.32); }
.roai-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #f6f7fb; }

/* State screens */
.roai-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    gap: 14px;
}
.roai-state h3 { margin: 0; font-size: 22px; color: #1d2340; }
.roai-state p { margin: 0; color: #4a5070; font-size: 15px; max-width: 520px; line-height: 1.6; }
.roai-state .roai-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #eef0ff; color: #4a3fd6; font-weight: 600; font-size: 13px; }
.roai-btn-primary {
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.roai-btn-primary:disabled { opacity: 0.6; cursor: default; }
.roai-btn-secondary {
    background: #fff;
    color: #4a3fd6;
    border: 1px solid #c9c7ff;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
}

/* "Ask the office manager" (non-manager users in an unregistered office) */
.roai-notify-preview { text-align: right; max-width: 520px; }
.roai-notify-preview ul { list-style: none; margin: 8px 0 0; padding: 0; }
.roai-notify-preview li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid #e4e6f2; border-radius: 10px; margin-bottom: 6px; background: #fff; font-size: 14px; }
.roai-notify-preview li span { color: #7a809c; font-size: 13px; }
.roai-notify-preview .fab.fa-whatsapp { color: #25d366; }
.roai-notify-done { color: #1f7a3f; background: #eafaf0; border: 1px solid #c4ecd3; border-radius: 10px; padding: 10px 14px; }
.roai-notify-error { color: #a11; background: #fff0f0; border: 1px solid #ffd0d0; border-radius: 10px; padding: 10px 14px; }

/* Trial bar */
.roai-trialbar {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 8px 14px;
    background: #fff7e6;
    color: #7a4b00;
    font-size: 13px;
    border-bottom: 1px solid #ffe2b3;
    flex-wrap: wrap;
}
.roai-trialbar b { color: #5a3600; }
.roai-trialbar .roai-link { margin-inline-start: auto; color: #4a3fd6; cursor: pointer; font-weight: 600; }

/* Agents grid */
.roai-agents { flex: 1; overflow: auto; padding: 18px; }
.roai-agents-intro { color: #4a5070; font-size: 14px; margin: 0 0 14px; }
.roai-agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.roai-agent-card {
    background: #fff;
    border: 1px solid #e4e6f2;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}
.roai-agent-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(74, 63, 214, 0.14); }
.roai-agent-card.roai-locked { opacity: 0.72; }
.roai-agent-card .roai-agent-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%);
}
.roai-agent-card.roai-icon-video .roai-agent-icon { background: linear-gradient(135deg, #ff6a88 0%, #ff99ac 100%); }
.roai-agent-card.roai-icon-flyer .roai-agent-icon { background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%); }
.roai-agent-card.roai-icon-cma .roai-agent-icon { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.roai-agent-card.roai-icon-remarks .roai-agent-icon { background: linear-gradient(135deg, #2f8bff 0%, #6a5cff 100%); }
.roai-agent-card.roai-icon-hub .roai-agent-icon { background: linear-gradient(135deg, #1d2340 0%, #4a3fd6 100%); }
.roai-agent-card h4 { margin: 0; font-size: 16px; color: #1d2340; }
.roai-agent-card p { margin: 0; font-size: 13px; color: #5b6180; line-height: 1.5; }
.roai-agent-card .roai-lock {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #f1f2f8;
    color: #5b6180;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
}
.roai-agent-card .roai-lock.roai-lock-pro { background: #1d2340; color: #ffd200; }
.roai-agent-card .roai-lock.roai-lock-open { background: #eafaf0; color: #1f7a3f; }

/* Paid services shown as agent cards (links to the contact page) */
a.roai-service-card, a.roai-service-card:hover, a.roai-service-card:focus { color: inherit; text-decoration: none; }
.roai-service-card:hover { opacity: 1; }
.roai-agent-card.roai-icon-calls .roai-agent-icon { background: linear-gradient(135deg, #8e2de2 0%, #c471f5 100%); }
.roai-agent-card.roai-icon-matches .roai-agent-icon { background: linear-gradient(135deg, #0f9bd7 0%, #4fd1ff 100%); }
.roai-agent-card.roai-icon-reply .roai-agent-icon { background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); }
.roai-agent-card.roai-icon-whatsapp .roai-agent-icon { background: linear-gradient(135deg, #1fa855 0%, #5be584 100%); }
.roai-service-cta { margin-top: auto; padding-top: 4px; font-size: 12.5px; font-weight: 600; color: #4a3fd6; }
.roai-service-cta .fa { font-size: 11px; margin-inline-start: 4px; }

/* Custom agents offer — last row under the agents grid */
.roai-more { margin-top: 22px; padding-top: 18px; border-top: 1px dashed #d9dbe8; }
.roai-more-custom h6 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: #1d2340; }
.roai-more-custom p { margin: 0; font-size: 12.5px; color: #5b6180; line-height: 1.5; }
.roai-more-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #4a3fd6;
    background: #eef0ff;
}
.roai-more-custom {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f3f1ff 0%, #eaf3ff 100%);
    border: 1px solid #d9d5ff;
}
.roai-more-custom .roai-more-icon { background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%); color: #fff; }
.roai-more-custom-text { flex: 1; min-width: 0; }
.roai-more-custom .roai-btn-secondary { flex: 0 0 auto; text-decoration: none; white-space: nowrap; font-weight: 600; }

@media (max-width: 700px) {
    .roai-more-custom { flex-wrap: wrap; }
}

/* Open chats / history rows */
.roai-section-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: #1d2340; }
.roai-section-title i { color: #5d52e8; margin-inline-end: 6px; }
.roai-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.roai-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e4e6f2;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: box-shadow 0.12s, border-color 0.12s;
}
.roai-row:hover { border-color: #c9c7ff; box-shadow: 0 6px 18px rgba(74, 63, 214, 0.1); }
.roai-row-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%);
}
.roai-row.roai-icon-video .roai-row-icon { background: linear-gradient(135deg, #ff6a88 0%, #ff99ac 100%); }
.roai-row.roai-icon-flyer .roai-row-icon { background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%); }
.roai-row.roai-icon-cma .roai-row-icon { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.roai-row.roai-icon-hub .roai-row-icon { background: linear-gradient(135deg, #1d2340 0%, #4a3fd6 100%); }
.roai-row-main { flex: 1; min-width: 0; }
.roai-row-title { font-size: 14px; font-weight: 700; color: #1d2340; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roai-row-card { font-weight: 400; color: #5b6180; font-size: 13px; }
.roai-row-tag { display: inline-block; font-size: 11px; font-weight: 600; background: #eafaf0; color: #1f7a3f; border-radius: 999px; padding: 0 8px; }
.roai-row-sub { font-size: 12px; color: #7a809c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.roai-row-busy { color: #4a3fd6; }
.roai-row-new { color: #c2183a; font-weight: 600; }
.roai-row-when { flex: 0 0 auto; font-size: 12px; color: #9aa0c0; white-space: nowrap; }
.roai-row-action {
    flex: 0 0 auto;
    border: none;
    background: #f1f2f8;
    color: #5b6180;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    line-height: 28px;
    padding: 0;
}
.roai-row-action:hover { background: #ffe3e8; color: #a11; }

/* Tabs: chats of the same card */
.roai-tabs {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 14px 0;
    background: #f6f7fb;
    overflow-x: auto;
    flex: 0 0 auto;
}
.roai-tab {
    border: 1px solid #e4e6f2;
    border-bottom: none;
    background: #eceef7;
    color: #4a5070;
    border-radius: 10px 10px 0 0;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}
.roai-tab:hover { background: #e2e4f3; }
.roai-tab.roai-tab-active { background: #fff; color: #1d2340; font-weight: 700; }
.roai-tab .roai-tab-busy { color: #4a3fd6; }
.roai-tab .roai-tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff3b5c; vertical-align: middle; }
.roai-tab.roai-tab-add { background: transparent; border-style: dashed; color: #4a3fd6; }
.roai-tab.roai-tab-all { margin-inline-start: auto; background: transparent; border: none; color: #4a3fd6; font-weight: 600; }

/* Chat */
.roai-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.roai-messages { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.roai-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6; word-wrap: break-word; white-space: pre-wrap; }
.roai-msg-user { align-self: flex-start; background: #6a5cff; color: #fff; border-bottom-right-radius: 4px; }
.roai-msg-agent { align-self: flex-end; background: #fff; color: #1d2340; border: 1px solid #e4e6f2; border-bottom-left-radius: 4px; white-space: normal; }
.roai-msg-agent .roai-md p { margin: 0 0 8px; }
.roai-msg-agent .roai-md p:last-child { margin-bottom: 0; }
.roai-msg-agent .roai-md ul, .roai-msg-agent .roai-md ol { margin: 4px 0 8px; padding-inline-start: 22px; }
.roai-msg-agent .roai-md img { max-width: 100%; border-radius: 10px; display: block; margin: 6px 0; }
.roai-msg-agent .roai-md video { max-width: 100%; border-radius: 10px; display: block; margin: 6px 0; background: #000; }
.roai-msg-agent .roai-md a { color: #2f6bff; word-break: break-all; }
.roai-msg-agent .roai-md code { background: #f1f2f8; padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.roai-msg-agent .roai-md pre { background: #f1f2f8; padding: 8px; border-radius: 8px; overflow: auto; direction: ltr; text-align: left; }
.roai-msg-agent .roai-md table { border-collapse: collapse; margin: 6px 0; }
.roai-msg-agent .roai-md td, .roai-msg-agent .roai-md th { border: 1px solid #e4e6f2; padding: 4px 8px; font-size: 13px; }
.roai-file-chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f2f8; border-radius: 8px; padding: 6px 10px; margin: 4px 4px 0 0; font-size: 13px; color: #1d2340; text-decoration: none; }
.roai-file-chip:hover { background: #e6e8f5; }
.roai-msg-user .roai-file-chip { background: rgba(255, 255, 255, 0.2); color: #fff; }
.roai-msg-system { align-self: center; background: transparent; color: #7a809c; font-size: 12px; padding: 2px 8px; }
.roai-msg-error { align-self: flex-end; background: #fff0f0; color: #a11; border: 1px solid #ffd0d0; }
.roai-typing { display: inline-flex; gap: 4px; align-items: center; }
.roai-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9aa0c0; animation: roai-blink 1.2s infinite; }
.roai-typing span:nth-child(2) { animation-delay: 0.2s; }
.roai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes roai-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.roai-tool-status { padding: 4px 18px; font-size: 12px; color: #4a3fd6; min-height: 20px; }
.roai-tool-status i { margin-inline-end: 6px; }

.roai-examples { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 8px; }
.roai-example { background: #fff; border: 1px solid #c9c7ff; color: #4a3fd6; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.roai-example:hover { background: #eef0ff; }

.roai-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px 14px; background: #fff; border-top: 1px solid #e4e6f2; }
.roai-composer textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    border: 1px solid #d9dbe8;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
}
.roai-composer textarea:focus { outline: none; border-color: #6a5cff; box-shadow: 0 0 0 3px rgba(106, 92, 255, 0.15); }
.roai-composer button {
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 16px;
}
.roai-composer .roai-send { background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%); color: #fff; padding: 0 18px; font-weight: 600; font-size: 14px; }
.roai-composer .roai-send:disabled { opacity: 0.5; cursor: default; }
.roai-composer .roai-attach { background: #f1f2f8; color: #4a5070; }
.roai-composer .roai-attach:hover { background: #e6e8f5; }
.roai-attachments { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 6px; background: #fff; }
.roai-attachment { display: inline-flex; align-items: center; gap: 6px; background: #eef0ff; color: #4a3fd6; border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.roai-attachment button { border: none; background: transparent; color: #4a3fd6; cursor: pointer; font-size: 14px; padding: 0; }

/* Minimized chats: one bubble per card, stacked upwards from the bottom-left corner */
.roai-bubbles {
    position: fixed;
    left: 22px;
    bottom: 22px;
    display: flex;
    flex-direction: column-reverse;
    gap: 26px;
    z-index: 1034;
    direction: rtl;
    font-family: "Heebo", "Arimo", Arial, sans-serif;
}
.roai-bubble {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a5cff 0%, #2f8bff 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(74, 63, 214, 0.45);
    transition: transform 0.15s;
}
.roai-bubble:hover { transform: scale(1.06); }
.roai-bubble.roai-icon-video { background: linear-gradient(135deg, #ff6a88 0%, #ff99ac 100%); box-shadow: 0 10px 30px rgba(255, 106, 136, 0.45); }
.roai-bubble.roai-icon-flyer { background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%); box-shadow: 0 10px 30px rgba(247, 151, 30, 0.45); }
.roai-bubble.roai-icon-cma { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); box-shadow: 0 10px 30px rgba(17, 153, 142, 0.45); }
.roai-bubble.roai-icon-hub,
.roai-bubble.roai-bubble-multi { background: linear-gradient(135deg, #1d2340 0%, #4a3fd6 100%); }
.roai-bubble.roai-bubble-more { width: 44px; height: 44px; font-size: 15px; font-weight: 700; margin-inline-start: 8px; background: #1d2340; }
.roai-bubble .roai-bubble-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #fff;
    color: #1d2340;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.roai-bubble .roai-bubble-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 3px;
    background: rgba(29, 35, 64, 0.85);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    padding: 0 7px;
    border-radius: 999px;
    white-space: nowrap;
    pointer-events: none;
}
.roai-bubble .roai-bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff3b5c;
    color: #fff;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
}
.roai-bubble .roai-bubble-working {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    animation: roai-spin 1s linear infinite;
}
@keyframes roai-spin { to { transform: rotate(360deg); } }

/* Admin (manager) list */
.roai-admin { flex: 1; overflow: auto; padding: 18px; }
.roai-admin table { width: 100%; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #e4e6f2; }
.roai-admin th, .roai-admin td { padding: 8px 12px; border-bottom: 1px solid #eef0f6; font-size: 14px; text-align: right; }
.roai-admin th { background: #f1f2f8; color: #4a5070; font-weight: 600; }
.roai-admin-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 14px; }

@media (max-width: 700px) {
    .roai-dialog { width: 100vw; height: 100vh; border-radius: 0; }
    .roai-msg { max-width: 92%; }
    .roai-row-when { display: none; }
}
