/* ============================================================
   iRobotix Live Chat Widget (WhatsApp-style)
   Opens from the existing floating "Chat with us" button.
   z-index: panel 10000 — always below modals (backdrop 10040 / modal 10050).
   ============================================================ */

/* Lift the whole floating group above Laravel Debugbar's bottom strip
   (z-index 10000 in local dev) while staying below modals (10040/10050). */
.floating-btn-grp {
    z-index: 10030;
}

.irbx-chat-panel {
    position: fixed;
    bottom: 95px;
    right: 30px;
    width: 372px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: calc(100vh - 130px);
    background: #ece5dd;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10030;
    font-family: inherit;
}

.irbx-chat-panel.irbx-open {
    display: flex;
    animation: irbxSlideUp 0.25s ease;
}

@keyframes irbxSlideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
.irbx-chat-header {
    background: #075e54;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.irbx-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.irbx-chat-head-info {
    flex-grow: 1;
    min-width: 0;
}

.irbx-chat-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: #fff;
}

.irbx-chat-status {
    font-size: 11.5px;
    color: #c8f0e4;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0 0;
}

.irbx-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4cd964;
    display: inline-block;
}

.irbx-head-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
    flex-shrink: 0;
}

.irbx-head-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.irbx-head-btn.irbx-close-btn {
    font-size: 16px;
    padding: 5px 10px;
}

/* ---------- Messages area ---------- */
.irbx-chat-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px 12px 8px;
    background: #ece5dd;
    background-image: radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px);
    background-size: 18px 18px;
    -webkit-overflow-scrolling: touch;
}

.irbx-msg {
    max-width: 82%;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    clear: both;
}

.irbx-msg a {
    color: #075e54;
    font-weight: 600;
    text-decoration: underline;
}

.irbx-msg-bot {
    background: #ffffff;
    color: #222;
    float: left;
    border-radius: 12px 12px 12px 3px;
}

.irbx-msg-user {
    background: #dcf8c6;
    color: #222;
    float: right;
    border-radius: 12px 12px 3px 12px;
}

.irbx-msg-time {
    display: block;
    font-size: 10px;
    color: #999;
    margin-top: 3px;
    text-align: right;
}

.irbx-chat-body::after {
    content: "";
    display: table;
    clear: both;
}

/* Typing indicator */
.irbx-typing {
    background: #fff;
    border-radius: 12px 12px 12px 3px;
    padding: 12px 14px;
    float: left;
    clear: both;
    margin-bottom: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.irbx-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b0b0b0;
    margin: 0 1.5px;
    animation: irbxBounce 1.2s infinite;
}

.irbx-typing span:nth-child(2) { animation-delay: 0.15s; }
.irbx-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes irbxBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ---------- Quick replies ---------- */
.irbx-quick-replies {
    padding: 6px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #ece5dd;
    flex-shrink: 0;
}

.irbx-quick-replies:empty {
    display: none;
}

.irbx-chip {
    background: #fff;
    border: 1px solid #075e54;
    color: #075e54;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.irbx-chip:hover {
    background: #075e54;
    color: #fff;
}

/* ---------- Input ---------- */
.irbx-chat-footer {
    padding: 8px 10px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.irbx-chat-input {
    flex-grow: 1;
    border: none;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    background: #fff;
    color: #222;
    min-width: 0;
}

.irbx-chat-input:disabled {
    background: #e8e8e8;
    cursor: not-allowed;
}

.irbx-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #075e54;
    border: none;
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

.irbx-send-btn:hover {
    background: #0a7d70;
    transform: scale(1.06);
}

.irbx-send-btn:disabled {
    background: #b0b0b0;
    cursor: not-allowed;
    transform: none;
}

/* WhatsApp handoff link */
.irbx-wa-link {
    text-align: center;
    padding: 5px 10px 8px;
    background: #f0f0f0;
    font-size: 11.5px;
    flex-shrink: 0;
}

.irbx-wa-link a {
    color: #128c7e;
    font-weight: 600;
    text-decoration: none;
}

.irbx-wa-link a:hover {
    text-decoration: underline;
}

/* ---------- Teaser (auto-popup engagement bubble) ---------- */
.irbx-teaser {
    position: absolute;
    right: 62px;
    bottom: 0;
    width: max-content; /* Container is only 50px wide — without this the bubble collapses to a 1-char column. */
    display: none;
    align-items: center;
    gap: 8px;
    animation: fadeInRight 0.45s ease;
    z-index: 10030;
}

.irbx-teaser.irbx-show {
    display: flex;
}

.irbx-teaser-text {
    background: #fff;
    color: #222;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    max-width: 240px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    border: 1px solid #f0f0f0;
    cursor: pointer;
    line-height: 1.45;
}

.irbx-teaser-close {
    background: #000;
    color: #fff;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Unread badge on the launcher */
.irbx-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53935;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.irbx-badge.irbx-show {
    display: flex;
}

/* Chat-ended note */
.irbx-ended-note {
    text-align: center;
    font-size: 12px;
    color: #777;
    background: #fdf3d7;
    border-radius: 8px;
    padding: 7px 10px;
    margin: 6px auto;
    clear: both;
}

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
    .irbx-chat-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 88vh;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
    }

    .irbx-teaser-text {
        max-width: 190px;
    }
}
