/**
 * Revi Sales Concierge — Chat Widget Styles
 */

/* Widget container — fixed bottom-right */
#alg-revi-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Action Button */
#alg-revi-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    bottom: 0;
    right: 0;
}

#alg-revi-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

#alg-revi-fab.alg-revi-fab-active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* Chat Panel */
#alg-revi-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-height: 1040px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.alg-revi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
}

.alg-revi-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#alg-revi-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

#alg-revi-close:hover {
    opacity: 1;
}

/* Messages Area */
.alg-revi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 720px;
    min-height: 400px;
}

/* Message Bubbles */
.alg-revi-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.alg-revi-msg a {
    color: inherit;
    text-decoration: underline;
}

.alg-revi-msg-assistant {
    background: #f0f0f5;
    color: #1e1e2e;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.alg-revi-msg-user {
    background: #4f46e5;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.alg-revi-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.alg-revi-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a5a5b5;
    animation: alg-revi-bounce 1.4s infinite ease-in-out both;
}

.alg-revi-typing span:nth-child(1) { animation-delay: -0.32s; }
.alg-revi-typing span:nth-child(2) { animation-delay: -0.16s; }
.alg-revi-typing span:nth-child(3) { animation-delay: 0s; }

@keyframes alg-revi-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Suggestion Bubbles */
.alg-revi-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 24px;
}

.alg-revi-bubble {
    background: #f0edff;
    color: #4f46e5;
    border: 1px solid #d4d0f0;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.alg-revi-bubble:hover {
    background: #e0dbff;
    border-color: #b5b0e0;
}

/* Input Area */
.alg-revi-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #e8e8ee;
    gap: 8px;
}

#alg-revi-input {
    flex: 1;
    border: 1px solid #d4d4dd;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

#alg-revi-input:focus {
    border-color: #4f46e5;
}

#alg-revi-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

#alg-revi-send:hover {
    background: #4338ca;
}

/* =========================================================================
   MOBILE RESPONSIVE
   ========================================================================= */

/* ---- Tablet ---- */
@media (max-width: 768px) {
    #alg-revi-widget {
        bottom: 12px;
        right: 12px;
    }

    #alg-revi-panel {
        position: fixed;
        bottom: 160px;
        right: 12px;
        left: auto;
        width: 66vw;
        max-height: calc(100vh - 180px);
        border-radius: 16px;
        z-index: 99999;
    }

    .alg-revi-messages {
        min-height: 200px;
        max-height: none;
    }

    #alg-revi-fab {
        width: 48px;
        height: 48px;
    }
}

/* ---- Large phones ---- */
@media (max-width: 480px) {
    #alg-revi-panel {
        width: 72vw;
        bottom: 150px;
        max-height: calc(100vh - 170px);
    }
}

/* ---- Small phones ---- */
@media (max-width: 375px) {
    #alg-revi-panel {
        width: 78vw;
        bottom: 140px;
        max-height: calc(100vh - 160px);
    }
}
