/* voice-assistant.css */

#voice-assistant-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: 'Inter', system-ui, sans-serif;
}

.va-island {
    position: relative;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px; /* Fully rounded pill/island */
    color: #e2e8f0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* Springy transition */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    
    /* Default collapsed state size */
    width: 110px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.va-island:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Expanded active state size */
.va-active .va-island {
    width: 280px;
    height: 56px;
    cursor: default;
    transform: none; /* Disable hover lift when active */
}

.va-island-section {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Default state layout */
#va-island-default {
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}
#va-island-default svg {
    stroke: #8b5cf6;
}

/* Active state layout */
#va-island-active {
    justify-content: space-between;
    padding: 0 16px;
}

/* Visibility toggles */
.va-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

/* --- Dynamic Visualizer --- */
.va-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}
.va-bar {
    width: 3px;
    height: 6px;
    border-radius: 3px;
    background: #64748b;
    transition: all 0.3s ease;
}

.va-status-text {
    flex-grow: 1;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    color: #a1a1aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.va-stop-button {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
.va-stop-button:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* --- State-based Animations & Colors --- */

/* Connecting... */
.va-active .va-island {
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

/* Listening State (Green) */
.va-listening .va-island {
    background: rgba(4, 47, 46, 0.9);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
}
.va-listening .va-status-text {
    color: #34d399;
}
.va-listening .va-bar {
    background: #10b981;
    animation: eqBounce 1s infinite alternate ease-in-out;
}
.va-listening .va-bar:nth-child(1) { animation-delay: 0.1s; }
.va-listening .va-bar:nth-child(2) { animation-delay: 0.3s; }
.va-listening .va-bar:nth-child(3) { animation-delay: 0.0s; }
.va-listening .va-bar:nth-child(4) { animation-delay: 0.4s; }
.va-listening .va-bar:nth-child(5) { animation-delay: 0.2s; }

/* Connecting State (Premium Shimmer) */
.va-connecting .va-island {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.95) 0%, rgba(59, 130, 246, 0.15) 50%, rgba(30, 41, 59, 0.95) 100%);
    background-size: 200% 100%;
    animation: shimmerBg 2s infinite linear;
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 0 25px rgba(96, 165, 250, 0.25);
}
.va-connecting .va-status-text {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    font-weight: 500;
    letter-spacing: 0.5px;
}
.va-connecting .va-bar {
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    animation: sleekPulse 1.2s infinite ease-in-out;
}
.va-connecting .va-bar:nth-child(1) { animation-delay: 0.0s; }
.va-connecting .va-bar:nth-child(2) { animation-delay: 0.1s; }
.va-connecting .va-bar:nth-child(3) { animation-delay: 0.2s; }
.va-connecting .va-bar:nth-child(4) { animation-delay: 0.3s; }
.va-connecting .va-bar:nth-child(5) { animation-delay: 0.4s; }

/* Thinking / Processing State (Yellow/Orange) */
.va-thinking .va-island {
    background: rgba(67, 20, 7, 0.9);
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: 0 10px 40px rgba(249, 115, 22, 0.4);
}
.va-thinking .va-status-text {
    color: #fb923c;
}
.va-thinking .va-bar {
    background: #f97316;
    animation: thinkPulse 1.5s infinite ease-in-out;
}
.va-thinking .va-bar:nth-child(1) { animation-delay: 0.0s; }
.va-thinking .va-bar:nth-child(2) { animation-delay: 0.15s; }
.va-thinking .va-bar:nth-child(3) { animation-delay: 0.3s; }
.va-thinking .va-bar:nth-child(4) { animation-delay: 0.45s; }
.va-thinking .va-bar:nth-child(5) { animation-delay: 0.6s; }

/* Speaking State (Cyan/Purple) */
.va-speaking .va-island {
    background: rgba(30, 27, 75, 0.9);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.4);
}
.va-speaking .va-status-text {
    color: #c084fc;
}
.va-speaking .va-bar {
    background: #8b5cf6;
    animation: eqBounce 0.5s infinite alternate ease-in-out;
}
.va-speaking .va-bar:nth-child(1) { animation-delay: 0.2s; }
.va-speaking .va-bar:nth-child(2) { animation-delay: 0.0s; }
.va-speaking .va-bar:nth-child(3) { animation-delay: 0.4s; }
.va-speaking .va-bar:nth-child(4) { animation-delay: 0.1s; }
.va-speaking .va-bar:nth-child(5) { animation-delay: 0.3s; }

/* Animations */
@keyframes eqBounce {
    0% { height: 6px; }
    100% { height: 24px; }
}

@keyframes thinkPulse {
    0%, 100% { height: 6px; opacity: 0.3; transform: scale(1); }
    50% { height: 12px; opacity: 1; transform: scale(1.2); }
}

@keyframes shimmerBg {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes sleekPulse {
    0%, 100% { height: 4px; opacity: 0.2; }
    50% { height: 16px; opacity: 1; }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    #voice-assistant-widget {
        /* Move to center-bottom, above the bottom nav */
        bottom: 80px; 
        right: 50%;
        transform: translateX(50%);
        align-items: center;
    }
    
    #va-island-default {
        /* Hide the floating pill trigger on mobile */
        display: none !important;
    }

    .va-island {
        /* Hide the whole container when inactive so it doesn't block clicks */
        opacity: 0;
        pointer-events: none;
    }

    .va-active .va-island {
        /* Show and position the active island */
        opacity: 1;
        pointer-events: auto;
    }
}
