﻿/* ══════════════════════════════════════════════════════════════════════════
   AREX VOICE AGENT — CONSISTENT ELECTRIC BLUE 3D GLASS ORB & HUD SYSTEM
   Isolated (.axw- prefixed) to prevent any page collisions.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. CLEAN FLOATING MIC BUTTON (FAB - Bottom Right) ──────────────────── */
.axw-fab {
    position: fixed; right: 28px; bottom: 28px; z-index: 2147483000;
    width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    touch-action: none; user-select: none; -webkit-user-select: none;
    
    /* Always Electric Blue 3D Sphere */
    background: radial-gradient(circle at 35% 30%, #38bdf8 0%, #2563eb 45%, #1e1b4b 85%, #0f172a 100%);
    box-shadow: 
        inset -5px -5px 12px rgba(0, 0, 0, 0.65),
        inset 5px 5px 12px rgba(255, 255, 255, 0.45),
        0 10px 30px rgba(37, 99, 235, 0.5),
        0 0 50px rgba(56, 189, 248, 0.3);
    
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    animation: 
        axwSpawn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        axwOrbIdle 4s ease-in-out infinite alternate;
}

@keyframes axwSpawn {
    0% { transform: scale(0) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes axwOrbIdle {
    0%   { transform: translateY(0) scale(1); }
    100% { transform: translateY(-4px) scale(1.03); }
}

.axw-fab::before {
    content: ''; position: absolute; inset: -10px; border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(37, 99, 235, 0.15) 55%, transparent 72%);
    animation: axwAuraBreathe 3s ease-in-out infinite alternate;
    pointer-events: none; z-index: -1;
}

@keyframes axwAuraBreathe {
    0%   { transform: scale(0.85); opacity: 0.3; }
    100% { transform: scale(1.25); opacity: 0.85; }
}

.axw-fab-icon {
    color: #ffffff; font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
    transition: transform 0.3s ease;
}

.axw-fab:hover {
    transform: translateY(-4px) scale(1.08) !important;
    box-shadow: inset -5px -5px 12px rgba(0,0,0,0.65), inset 5px 5px 14px rgba(255,255,255,0.6), 0 16px 45px rgba(56,189,248,0.7);
}

.axw-fab.axw-dragging { cursor: grabbing; transition: none !important; transform: scale(1.1) !important; }

/* Active states (Keep core blue, boost cyan energy glow) */
.axw-fab.axw-connecting {
    box-shadow: inset -5px -5px 12px rgba(0,0,0,0.65), inset 5px 5px 12px rgba(255,255,255,0.5), 0 0 60px rgba(56,189,248,0.75);
}
.axw-fab.axw-live {
    box-shadow: inset -5px -5px 12px rgba(0,0,0,0.65), inset 5px 5px 14px rgba(255,255,255,0.6), 0 0 70px rgba(56,189,248,0.85);
}
.axw-fab.axw-speaking {
    box-shadow: inset -5px -5px 12px rgba(0,0,0,0.65), inset 5px 5px 14px rgba(255,255,255,0.7), 0 0 85px rgba(129,140,248,0.9);
    animation: axwOrbIdle 2s ease-in-out infinite alternate, axwFabPulse 0.5s ease-in-out infinite alternate;
}
@keyframes axwFabPulse {
    0%   { transform: scale(0.96); }
    100% { transform: scale(1.06); }
}


/* ── 2. HUD CONTAINER ───────────────────────────────────────────────────── */
.axw-hud {
    position: fixed; right: 28px; bottom: 106px; z-index: 2147483000;
    width: 290px; padding: 28px 24px 24px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    
    background: rgba(10, 14, 28, 0.88);
    backdrop-filter: blur(32px) saturate(200%); -webkit-backdrop-filter: blur(32px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 40px;
    box-shadow: 
        0 35px 80px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 0 80px rgba(56, 189, 248, 0.18);
    
    transform-origin: bottom right;
    animation: axwHudOpen 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes axwHudOpen {
    0%   { opacity: 0; transform: scale(0.6) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.axw-hud-close {
    position: absolute; top: 18px; right: 18px;
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06); color: #94a3b8; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
    transition: all 0.2s ease;
}
.axw-hud-close:hover {
    background: rgba(239, 68, 68, 0.25); border-color: rgba(239,68,68,0.6); color: #fff;
    box-shadow: 0 0 14px rgba(239,68,68,0.5);
}


/* ── 3. CONSISTENT ELECTRIC BLUE 3D GLASS ORB (Matches Alpha AI) ────────── */
.axw-orb-container {
    position: relative; width: 150px; height: 150px;
    display: flex; align-items: center; justify-content: center;
    margin: 6px 0 20px;
}

/* Ambient Back Glow Field */
.axw-orb-glow {
    position: absolute; inset: -15px; border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.5) 0%, rgba(37, 99, 235, 0.25) 50%, transparent 75%);
    filter: blur(24px); pointer-events: none; z-index: 0;
    transition: background 0.6s ease, opacity 0.6s ease;
    animation: axwGlowPulse 4s ease-in-out infinite alternate;
}

@keyframes axwGlowPulse {
    0%   { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 0.95; transform: scale(1.15); }
}

/* Orbital Halo Rings */
.axw-orb-ring-1 {
    position: absolute; inset: -10px; border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(56, 189, 248, 0.7);
    border-bottom-color: rgba(99, 102, 241, 0.5);
    animation: axwRingRotateClockwise 6s linear infinite; pointer-events: none; z-index: 1;
}

.axw-orb-ring-2 {
    position: absolute; inset: -22px; border-radius: 50%;
    border: 1px dashed rgba(56, 189, 248, 0.3);
    animation: axwRingRotateCounter 12s linear infinite; pointer-events: none; z-index: 1;
}

@keyframes axwRingRotateClockwise {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes axwRingRotateCounter {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* 3D GLASS SPHERE CORE — Always Vibrant Blue (Exact Match with Alpha AI Page) */
.axw-orb-glass {
    position: relative; width: 130px; height: 130px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.3) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, #2563eb 0%, #1d4ed8 40%, #0f172a 80%, #020617 100%);
    box-shadow:
        inset 0 0 42px rgba(56, 189, 248, 0.5),
        inset 0 -34px 58px rgba(0, 0, 0, 0.8),
        inset 0 22px 40px rgba(255, 255, 255, 0.22),
        inset -12px -12px 30px rgba(37, 99, 235, 0.35),
        0 15px 40px rgba(0, 0, 0, 0.6),
        0 0 65px rgba(56, 189, 248, 0.4);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.5s ease; z-index: 2;
    animation: axwOrbFloat 4s ease-in-out infinite alternate;
}

@keyframes axwOrbFloat {
    0%   { transform: translateY(0) scale(0.98); }
    100% { transform: translateY(-4px) scale(1.03); }
}

/* Glass Crescent Specular Reflection Arc */
.axw-orb-glass::before {
    content: '';
    position: absolute; top: 6%; left: 12%;
    width: 76%; height: 34%;
    border-radius: 50% 50% 15% 15% / 50% 50% 20% 20%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0) 100%);
    transform: rotate(-12deg);
    filter: blur(1px);
    pointer-events: none; z-index: 3;
}

/* Mic Icon inside Glass Orb */
.axw-orb-mic {
    color: #ffffff; font-size: 36px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    z-index: 6; transition: transform 0.3s ease;
}

/* ── 4. STATE ENERGY BOOST (Core remains Blue, Outer Glow updates) ─────── */

/* State: Live / Listening */
.axw-hud.axw-state-live .axw-orb-glow {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.65) 0%, rgba(37, 99, 235, 0.35) 50%, transparent 75%);
}
.axw-hud.axw-state-live .axw-orb-glass {
    box-shadow:
        inset 0 0 45px rgba(56, 189, 248, 0.6),
        inset 0 -34px 58px rgba(0, 0, 0, 0.8),
        inset 0 22px 40px rgba(255, 255, 255, 0.28),
        0 0 75px rgba(56, 189, 248, 0.6);
}

/* State: Speaking (Pulse Cyan Blue Energy) */
.axw-hud.axw-state-speaking .axw-orb-glow {
    background: radial-gradient(circle, rgba(129, 140, 248, 0.75) 0%, rgba(56, 189, 248, 0.4) 50%, transparent 75%);
}
.axw-hud.axw-state-speaking .axw-orb-glass {
    box-shadow:
        inset 0 0 50px rgba(129, 140, 248, 0.7),
        inset 0 -34px 58px rgba(0, 0, 0, 0.8),
        inset 0 22px 40px rgba(255, 255, 255, 0.35),
        0 0 85px rgba(56, 189, 248, 0.85);
    animation: axwOrbFloat 4s ease-in-out infinite alternate, axwOrbSpeakPulse 0.55s ease-in-out infinite alternate;
}

@keyframes axwOrbSpeakPulse {
    0%   { transform: scale(0.96); filter: brightness(1); }
    100% { transform: scale(1.06); filter: brightness(1.2); }
}

/* State: Connecting */
.axw-hud.axw-state-connecting .axw-orb-glow {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.55) 0%, rgba(37, 99, 235, 0.3) 50%, transparent 75%);
}


/* ── 5. HUD STATUS & CONTROLS ───────────────────────────────────────────── */
.axw-hud-status {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.92rem; font-weight: 600; color: #cbd5e1; text-align: center;
    letter-spacing: 0.02em; margin-bottom: 14px;
}
.axw-hud.axw-state-live .axw-hud-status { color: #38bdf8; text-shadow: 0 0 10px rgba(56,189,248,0.35); }
.axw-hud.axw-state-speaking .axw-hud-status { color: #818cf8; text-shadow: 0 0 10px rgba(129,140,248,0.35); }
.axw-hud.axw-state-connecting .axw-hud-status { color: #7dd3fc; text-shadow: 0 0 10px rgba(125,211,252,0.35); }

/* Audio Wave Equalizer */
.axw-hud-waves {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    height: 22px; margin-bottom: 18px; opacity: 0; transition: opacity 0.3s ease;
}
.axw-hud.axw-state-speaking .axw-hud-waves { opacity: 1; }

.axw-hud-wave-bar {
    width: 3.5px; border-radius: 4px;
    background: linear-gradient(180deg, #38bdf8, #6366f1);
    animation: axwWaveEqualizer 0.7s ease-in-out infinite alternate;
}
.axw-hud-wave-bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.axw-hud-wave-bar:nth-child(2) { height: 16px; animation-delay: 0.12s; }
.axw-hud-wave-bar:nth-child(3) { height: 22px; animation-delay: 0.05s; }
.axw-hud-wave-bar:nth-child(4) { height: 12px; animation-delay: 0.18s; }
.axw-hud-wave-bar:nth-child(5) { height: 18px; animation-delay: 0.08s; }
.axw-hud-wave-bar:nth-child(6) { height: 8px; animation-delay: 0.22s; }

@keyframes axwWaveEqualizer {
    0%   { transform: scaleY(0.3); opacity: 0.5; }
    100% { transform: scaleY(1); opacity: 1; }
}

/* Premium End Session Button */
.axw-hud-stop {
    padding: 11px 28px; border-radius: 30px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(185, 28, 28, 0.25) 100%);
    color: #fca5a5; font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    cursor: pointer; transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.axw-hud-stop:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(185, 28, 28, 0.45) 100%);
    border-color: rgba(239, 68, 68, 0.7); color: #fff;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Utility hide */
.axw-hidden { 
    opacity: 0 !important; transform: scale(0.5) translateY(30px) !important; pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .axw-fab, .axw-hud, .axw-orb-glass { animation: none !important; transition: none !important; }
}
