/* ═══════════════════════════════════════════════════════════
   ROSA SOLUTIONS — SALES CHATBOT WIDGET
   Colors match design-system.css design tokens
   ═══════════════════════════════════════════════════════════ */

/* ── Chatbot Launcher Button ─────────────────────────────── */
#rosa-chat-launcher {
    position: static;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E55D25 0%, #D44A1A 100%);
    box-shadow: 0 4px 20px rgba(229, 93, 37, 0.45);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: chat-shake 4s ease-in-out 1s 3, chat-pulse 3s ease-in-out 14s infinite;
    flex-shrink: 0;
}

#rosa-chat-launcher:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 8px 28px rgba(229, 93, 37, 0.55);
    animation: none;
}

#rosa-chat-launcher svg {
    width: 26px;
    height: 26px;
    fill: #fff;
    transition: all 0.2s ease;
}

#rosa-chat-launcher.open svg.icon-chat { display: none; }
#rosa-chat-launcher.open svg.icon-close { display: block; }
#rosa-chat-launcher:not(.open) svg.icon-chat { display: block; }
#rosa-chat-launcher:not(.open) svg.icon-close { display: none; }

@keyframes chat-shake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10%       { transform: rotate(-7deg) scale(1.05); }
    20%       { transform: rotate(7deg) scale(1.05); }
    30%       { transform: rotate(-5deg) scale(1.03); }
    40%       { transform: rotate(5deg) scale(1.03); }
    50%       { transform: rotate(-2deg); }
    70%       { transform: rotate(0deg) scale(1); }
}

@keyframes wa-shake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10%       { transform: rotate(-8deg) scale(1.05); }
    20%       { transform: rotate(8deg) scale(1.05); }
    30%       { transform: rotate(-6deg) scale(1.03); }
    40%       { transform: rotate(6deg) scale(1.03); }
    70%       { transform: rotate(0deg) scale(1); }
}

@keyframes wa-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35); }
    50%       { box-shadow: 0 4px 28px rgba(37, 211, 102, 0.65), 0 0 0 10px rgba(37, 211, 102, 0.08); }
}

/* Notification badge */
#rosa-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    animation: badge-bounce 1.5s ease-in-out 2s 3;
}

@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ── Chat Window ─────────────────────────────────────────── */

#rosa-chat-window {
    position: fixed;
    bottom: 160px;
    right: 28px;
    z-index: 8999;
    width: 380px;
    max-height: 580px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Inter', -apple-system, sans-serif;
}

#rosa-chat-window.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
#rosa-chat-header {
    background: linear-gradient(135deg, #E55D25 0%, #D44A1A 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.chat-header-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.chat-status-dot {
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
    display: inline-block;
    animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Chat Body — Message Area */
#rosa-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #F9FAFB;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#rosa-chat-body::-webkit-scrollbar {
    width: 4px;
}

#rosa-chat-body::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 4px;
}

/* Message Bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    animation: msg-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes msg-appear {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg.bot {
    align-items: flex-start;
}

.chat-msg.user {
    align-items: flex-end;
}

.chat-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1F2937;
}

.chat-msg.bot .chat-bubble {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #E55D25, #D44A1A);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 70px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Quick Reply Chips */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.qr-chip {
    background: #fff;
    border: 1.5px solid #E55D25;
    color: #E55D25;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.qr-chip:hover {
    background: #E55D25;
    color: #fff;
    transform: translateY(-1px);
}

/* CTA Button in chat */
.chat-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #E55D25, #D44A1A);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 100px;
    text-decoration: none;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(229, 93, 37, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-family: 'Inter', sans-serif;
    width: fit-content;
}

.chat-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(229, 93, 37, 0.4);
}

.chat-cta-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #E55D25;
    color: #E55D25;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 100px;
    text-decoration: none;
    margin-top: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    width: fit-content;
}

.chat-cta-ghost:hover {
    background: #E55D25;
    color: #fff;
}

/* ── Chat Input ──────────────────────────────────────────── */
#rosa-chat-input-area {
    border-top: 1px solid #E5E7EB;
    padding: 12px 16px;
    background: #fff;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

#rosa-chat-input {
    flex: 1;
    border: 1.5px solid #E5E7EB;
    border-radius: 100px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: 'Inter', sans-serif;
    color: #1F2937;
    background: #F9FAFB;
    outline: none;
    transition: border-color 0.2s ease;
}

#rosa-chat-input:focus {
    border-color: #E55D25;
    background: #fff;
}

#rosa-chat-input::placeholder {
    color: #9CA3AF;
}

#rosa-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E55D25, #D44A1A);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(229, 93, 37, 0.3);
}

#rosa-chat-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(229, 93, 37, 0.4);
}

#rosa-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ── Mobile Responsive ───────────────────────────────────── */
@media (max-width: 480px) {
    #rosa-chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 168px;
        max-height: calc(100vh - 120px);
        border-radius: 16px;
    }

    #rosa-chat-launcher {
        bottom: 92px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}
