/* ==========================================================================
   AI Character Messenger v2.0 - Core Styling
   Telegram / WhatsApp Dark Theme with Glassmorphism & Adaptive State Elements
   ========================================================================== */

:root {
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-chat: #0f172a;
    --bg-header: #1e293b;
    --bubble-user: #065f46;
    --bubble-ai: #1e293b;
    --bubble-user-border: #059669;
    --bubble-ai-border: #334155;
    --accent-primary: #8b5cf6;
    --accent-sensual: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Chat Message Bubbles */
.chat-bubble {
    position: relative;
    max-width: 82%;
    word-break: break-word;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    animation: fadeInBubble 0.25s ease-out forwards;
}

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

.chat-bubble-ai {
    background-color: var(--bubble-ai);
    border: 1px solid var(--bubble-ai-border);
    border-bottom-left-radius: 0.25rem;
    align-self: flex-start;
}

.chat-bubble-user {
    background: linear-gradient(135deg, #065f46, #047857);
    border: 1px solid #10b981;
    border-bottom-right-radius: 0.25rem;
    align-self: flex-end;
}

/* Asterisk Action / RP Narration Text Styling */
.rp-action {
    font-style: italic;
    color: #c084fc; /* Soft purple */
    font-family: Georgia, Cambria, "Times New Roman", Times, serif;
    background: rgba(192, 132, 252, 0.08);
    padding: 1px 4px;
    border-radius: 4px;
}

/* Audio Player Waveform Visualizer */
.audio-waveform-bar {
    display: inline-block;
    width: 3px;
    background-color: #a78bfa;
    border-radius: 9999px;
    margin: 0 1px;
    animation: wavePulse 1.2s infinite ease-in-out;
}

.audio-waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.audio-waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 22px; }
.audio-waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 12px; }
.audio-waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 18px; }
.audio-waveform-bar:nth-child(6) { animation-delay: 0.5s; height: 24px; }
.audio-waveform-bar:nth-child(7) { animation-delay: 0.2s; height: 14px; }
.audio-waveform-bar:nth-child(8) { animation-delay: 0.3s; height: 20px; }

@keyframes wavePulse {
    0%, 100% {
        transform: scaleY(0.4);
    }
    50% {
        transform: scaleY(1);
    }
}

/* Pulsing Status Indicators */
.pulse-online {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Glassmorphism Modals */
.modal-backdrop {
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: #111827;
    border: 1px solid #374151;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Range Slider Styling */
input[type=range] {
    accent-color: #8b5cf6;
}

/* Mobile Sidebar Drawer */
@media (max-width: 768px) {
    .sidebar-mobile {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 85%;
        max-width: 340px;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    .sidebar-mobile.open {
        transform: translateX(0);
    }
}
