/* 
============================================================
Photorba — Live Support Chat Styles
============================================================
*/

:root {
    --chat-accent: #f97316;
    --chat-bg: rgba(15, 20, 25, 0.85);
    --chat-text: #ffffff;
    --chat-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* Floating Button */
#rba-chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 22px;
    background: var(--chat-accent);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#rba-chat-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(249, 115, 22, 0.5);
}

#rba-chat-launcher img {
    width: 100%;
    height: 100%;
    border-radius: 22px;
    object-fit: cover;
    border: 2px solid white;
}

/* Online Indicator */
.chat-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #22c55e;
    border: 3px solid #0f1419;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Proactive Bubble */
#rba-chat-proactive {
    position: fixed;
    bottom: 105px;
    right: 30px;
    max-width: 260px;
    background: white;
    color: #1a1a1a;
    padding: 15px 20px;
    border-radius: 20px 20px 5px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--chat-shadow);
    z-index: 9998;
    display: none;
    animation: slideInUp 0.5s ease-out;
}

#rba-chat-proactive::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 15px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent transparent;
}

/* Main Chat Window */
#rba-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 150px);
    background: var(--chat-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    box-shadow: var(--chat-shadow);
    transition: all 0.3s ease;
}

/* Chat Header - Scoped to avoid collisions */
#rba-chat-window .chat-header {
    padding: 25px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
}

#rba-chat-window .chat-header .agent-avatar {
    width: 45px;
    height: 45px;
    border-radius: 15px;
    border: 2px solid var(--chat-accent);
}

#rba-chat-window .chat-header .agent-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

#rba-chat-window .chat-header .agent-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.6;
}

/* Messages Area */
#rba-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.msg {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.msg-user {
    align-self: flex-end;
    background: var(--chat-accent);
    color: white;
    border-radius: 18px 18px 2px 18px;
}

.msg-admin {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    color: white;
    border-radius: 18px 18px 18px 2px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.msg-admin .agent-name {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--chat-accent);
    font-weight: 800;
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 12px 15px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--chat-accent);
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    background: var(--chat-accent);
    border: none;
    border-radius: 15px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-send-btn:active {
    transform: scale(0.9);
}

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

/* Mobile Adjustments (Optimized for iOS/Android) */
@media (max-width: 480px) {
    #rba-chat-launcher {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    #rba-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }

    .chat-header {
        padding: 15px 20px;
        padding-top: env(safe-area-inset-top, 20px);
    }

    .chat-input-area {
        padding: 15px;
        padding-bottom: env(safe-area-inset-bottom, 15px);
        background: rgba(15, 20, 25, 0.95);
    }

    #rba-chat-messages {
        padding: 15px;
    }

    .msg {
        max-width: 90%;
    }

    #rba-chat-proactive {
        width: calc(100% - 40px);
        left: 20px;
        bottom: 85px;
    }
}
