/* ================================
   REDBOX CHATBOT - Frontend CSS
================================ */

/* --- Floating Wrap --- */
#rcb-floating-wrap {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
#rcb-floating-wrap.rcb-pos-left  { left: 24px; align-items: flex-start; }
#rcb-floating-wrap.rcb-pos-right { right: 24px; align-items: flex-end; }

/* --- Bubble Button --- */
#rcb-bubble-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.20);
    transition: transform .2s ease, box-shadow .2s ease;
    outline: none;
}
#rcb-bubble-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,.28);
}

/* --- Chat Window (floating) --- */
#rcb-chat-window {
    margin-bottom: 12px;
    width: 360px;
    max-height: 520px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    animation: rcb-slide-up .25s ease;
}
#rcb-chat-window.rcb-hidden { display: none !important; }

@keyframes rcb-slide-up {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}

/* --- Chat Container --- */
.rcb-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8fafc;
    font-family: Tahoma, 'Segoe UI', sans-serif;
    direction: rtl;
}

/* --- Header --- */
.rcb-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    flex-shrink: 0;
}
.rcb-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rcb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rcb-bot-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.rcb-status {
    font-size: 11px;
    color: rgba(255,255,255,0.85);
    margin-top: 2px;
}
.rcb-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rcb-lang-toggle {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
    transition: background .15s;
}
.rcb-lang-toggle:hover { background: rgba(255,255,255,0.32); }
.rcb-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.rcb-close-btn:hover { background: rgba(255,255,255,0.35); }

/* --- Messages --- */
.rcb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.rcb-messages::-webkit-scrollbar { width: 4px; }
.rcb-messages::-webkit-scrollbar-track { background: transparent; }
.rcb-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.rcb-msg {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    animation: rcb-fade-in .2s ease;
}
@keyframes rcb-fade-in {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0); }
}
.rcb-msg-bot  { justify-content: flex-end; }
.rcb-msg-user { justify-content: flex-start; }

.rcb-msg-text {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.7;
    word-break: break-word;
}
.rcb-msg-bot  .rcb-msg-text {
    background: #fff;
    color: #1e293b;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.rcb-msg-user .rcb-msg-text {
    color: #fff;
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.rcb-typing .rcb-msg-text {
    padding: 12px 16px;
}
.rcb-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.rcb-typing-dots span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: rcb-bounce .9s infinite;
}
.rcb-typing-dots span:nth-child(2) { animation-delay: .15s; }
.rcb-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes rcb-bounce {
    0%,80%,100% { transform:translateY(0); }
    40%          { transform:translateY(-6px); }
}

/* Contact button in fallback */
.rcb-contact-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid currentColor;
    transition: all .2s;
}
.rcb-contact-btn:hover {
    opacity: .8;
}

/* --- Input Area --- */
.rcb-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.rcb-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 9px 14px;
    font-size: 13px;
    font-family: Tahoma, sans-serif;
    outline: none;
    transition: border-color .2s;
    background: #f8fafc;
    direction: rtl;
}
.rcb-input[dir="ltr"] { direction: ltr; }
.rcb-input:focus { border-color: #00a796; background: #fff; }
.rcb-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .15s, opacity .15s;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    box-sizing: border-box;
}
.rcb-send-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: #fff;
    pointer-events: none;
    flex-shrink: 0;
}
.rcb-send-btn:hover { transform: scale(1.08); opacity: .9; }
.rcb-send-btn:active { transform: scale(.95); }

/* --- Shortcode wrap --- */
.rcb-shortcode-wrap .rcb-chat-container { border-radius: 16px; overflow: hidden; }

/* --- Elementor wrap --- */
.rcb-elementor-wrap .rcb-chat-container { height: 100%; }

/* --- Responsive --- */
@media (max-width: 480px) {
    #rcb-chat-window { width: calc(100vw - 32px); }
    #rcb-floating-wrap.rcb-pos-left  { left: 16px; }
    #rcb-floating-wrap.rcb-pos-right { right: 16px; }
}
