/* Support Widget (Renamed to Quick Help) */
.rm-assist-fab {
    position: fixed;
    bottom: 160px; /* Raised significantly to clear player bar */
    right: 20px;
    z-index: 2147483647; /* Max Z-Index */
    font-family: 'Inter', sans-serif;
    display: block !important;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.rm-assist-toggle {
    min-width: 48px;
    width: auto;
    height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    border: none;
    cursor: pointer;
    display: flex !important; /* Force flex display */
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse-glow 2s infinite; /* Make it pulse to be found easily */
}

.rm-assist-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    animation: none; /* Stop pulsing on hover */
}

.rm-assist-toggle svg {
    color: white;
    width: 20px;
    height: 20px;
}

.rm-support-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.rm-support-window.open {
    transform: scale(1);
    opacity: 1;
}

.rm-support-header {
    padding: 15px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rm-support-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.rm-support-close:hover {
    color: white;
}

.rm-support-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar for messages */
.rm-support-messages::-webkit-scrollbar {
    width: 6px;
}
.rm-support-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.ai {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

.message.user {
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
}

.rm-support-input-area {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rm-support-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: background 0.2s;
}

.rm-support-input:focus {
    background: rgba(255, 255, 255, 0.15);
}

.rm-support-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6366f1;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.rm-support-send:hover {
    background: #4f46e5;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1a1a2e;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 768px) {
    .rm-support-window {
        position: fixed;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: 520px;
        margin-left: auto;
        margin-right: auto;
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        height: min(62dvh, 520px);
        max-height: calc(100dvh - 160px);
        border-radius: 16px;
    }
    .rm-support-messages {
        padding: 12px;
        gap: 10px;
    }
    .rm-support-input-area {
        padding: 12px;
    }
}

/* Mobile: reduce button size and hide label for compact UI */
@media (max-width: 576px) {
    .rm-assist-fab {
        right: 14px;
        bottom: 120px; /* stays above mini-player + nav */
    }
    .rm-support-window {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
        height: min(58dvh, 480px);
        max-height: calc(100dvh - 140px);
    }
    .message {
        max-width: 92%;
        font-size: 0.92rem;
    }
    .rm-assist-toggle {
        min-width: 44px;
        height: 44px;
        padding: 0 10px;
        border-radius: 22px;
        box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
        animation: none; /* reduce visual noise on small screens */
    }
    .rm-assist-toggle svg {
        width: 22px;
        height: 22px;
    }
    .rm-assist-toggle span {
        display: none; /* icon-only on phones */
    }
}
