/* ==========================================================================
   THE NANOVERSE - Universal Voice Search CSS (Groq Whisper Powered)
   Advanced Cosmic UI & UX for Search Bar Microphone Voice Input
   ========================================================================== */

/* --- 1. Root & Variables --- */
:root {
    --nv-voice-cyan: #00f0ff;
    --nv-voice-cyan-glow: rgba(0, 240, 255, 0.45);
    --nv-voice-purple: #a855f7;
    --nv-voice-purple-glow: rgba(168, 85, 247, 0.45);
    --nv-voice-red: #ff3366;
    --nv-voice-red-glow: rgba(255, 51, 102, 0.5);
    --nv-voice-glass-bg: rgba(15, 18, 35, 0.75);
    --nv-voice-glass-border: rgba(255, 255, 255, 0.12);
}

/* --- 2. Microphone Buttons Base Styling --- */
.mic-button-home,
.mic-button-results {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.65);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mic-button-home:hover,
.mic-button-results:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
    transform: scale(1.06);
}

.mic-button-home:active,
.mic-button-results:active {
    transform: scale(0.96);
}

.mic-button-home svg,
.mic-button-results svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease, stroke 0.2s ease;
    pointer-events: none;
}

/* --- 3. Recording / Listening Active State --- */
.mic-button-home.is-recording,
.mic-button-results.is-recording {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.25), rgba(168, 85, 247, 0.35));
    border-color: var(--nv-voice-red);
    box-shadow: 0 0 20px var(--nv-voice-red-glow), 0 0 40px rgba(168, 85, 247, 0.2);
    animation: nvVoicePulse 1.6s ease-in-out infinite;
}

.mic-button-home.is-recording svg,
.mic-button-results.is-recording svg {
    stroke: #ff3366;
    filter: drop-shadow(0 0 6px #ff3366);
    transform: scale(1.1);
}

/* Concentric Ripple Waves */
.mic-button-home.is-recording::before,
.mic-button-home.is-recording::after,
.mic-button-results.is-recording::before,
.mic-button-results.is-recording::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 51, 102, 0.6);
    opacity: 0;
    pointer-events: none;
    animation: nvVoiceRipple 2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.mic-button-home.is-recording::after,
.mic-button-results.is-recording::after {
    animation-delay: 0.9s;
    border-color: rgba(0, 240, 255, 0.6);
}

@keyframes nvVoicePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 16px var(--nv-voice-red-glow), 0 0 30px rgba(168, 85, 247, 0.2);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 26px var(--nv-voice-red-glow), 0 0 50px rgba(168, 85, 247, 0.4);
    }
}

@keyframes nvVoiceRipple {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.85);
        opacity: 0;
    }
}

/* --- 4. Transcribing / Processing State --- */
.mic-button-home.is-transcribing,
.mic-button-results.is-transcribing {
    color: var(--nv-voice-cyan);
    background: rgba(0, 240, 255, 0.12);
    border-color: var(--nv-voice-cyan);
    box-shadow: 0 0 20px var(--nv-voice-cyan-glow);
    cursor: wait;
}

.mic-button-home.is-transcribing svg,
.mic-button-results.is-transcribing svg {
    animation: nvVoiceSpin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    stroke: var(--nv-voice-cyan);
    filter: drop-shadow(0 0 8px var(--nv-voice-cyan));
}

@keyframes nvVoiceSpin {
    0% { transform: rotate(0deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1.05); }
}

/* --- 5. Success State --- */
.mic-button-home.is-success,
.mic-button-results.is-success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.18);
    border-color: #10b981;
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.45);
    transform: scale(1.05);
}

.mic-button-home.is-success svg,
.mic-button-results.is-success svg {
    stroke: #10b981;
    filter: drop-shadow(0 0 6px #10b981);
}

/* --- 6. Search Bar Container Active Listening Mode --- */
.search-form-container.voice-listening #search-form-home,
.search-form-container.voice-listening #search-form-results,
.nv-command-bar.voice-listening #search-form-results {
    border-color: rgba(255, 51, 102, 0.55) !important;
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.22), 0 0 60px rgba(168, 85, 247, 0.15) !important;
    background: rgba(18, 16, 32, 0.85) !important;
    transition: all 0.3s ease;
}

.search-form-container.voice-transcribing #search-form-home,
.search-form-container.voice-transcribing #search-form-results,
.nv-command-bar.voice-transcribing #search-form-results {
    border-color: rgba(0, 240, 255, 0.6) !important;
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.25), 0 0 70px rgba(168, 85, 247, 0.2) !important;
    transition: all 0.3s ease;
}

/* Input shimmer text when listening */
.search-form-container.voice-listening input::placeholder {
    color: rgba(255, 120, 160, 0.85) !important;
    font-style: italic;
}

.search-form-container.voice-transcribing input::placeholder {
    color: rgba(0, 240, 255, 0.85) !important;
    font-style: italic;
}

/* --- 7. Voice Live Equalizer Overlay & Status Pill --- */
.nv-voice-overlay-pill {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    background: rgba(12, 14, 28, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 240, 255, 0.18);
    color: #ffffff;
    font-size: 0.86rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
    white-space: nowrap;
}

.nv-voice-overlay-pill.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nv-voice-overlay-pill.status-error {
    border-color: rgba(255, 51, 102, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 51, 102, 0.25);
}

.nv-voice-overlay-pill.status-success {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(16, 185, 129, 0.25);
}

/* Status Indicator Dot */
.nv-voice-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff3366;
    box-shadow: 0 0 10px #ff3366;
    flex-shrink: 0;
    animation: nvVoiceDotPulse 1.2s infinite ease-in-out;
}

.nv-voice-overlay-pill.status-transcribing .nv-voice-dot {
    background: #00f0ff;
    box-shadow: 0 0 10px #00f0ff;
}

.nv-voice-overlay-pill.status-success .nv-voice-dot {
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: none;
}

.nv-voice-overlay-pill.status-error .nv-voice-dot {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
    animation: none;
}

@keyframes nvVoiceDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

/* Audio Wave Visualizer Bars in Pill */
.nv-voice-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 18px;
}

.nv-voice-bar {
    width: 3px;
    height: 6px;
    border-radius: 9999px;
    background: linear-gradient(180deg, #00f0ff, #a855f7);
    transition: height 0.08s ease;
}

/* Timer Counter */
.nv-voice-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

/* Model Badge */
.nv-voice-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.28);
    color: #00f0ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Pill Cancel Button */
.nv-voice-cancel-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 2px 4px;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.nv-voice-cancel-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* --- 8. Floating Waveform Canvas inside Search Bar --- */
.nv-voice-canvas-container {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.search-form-container.voice-listening .nv-voice-canvas-container {
    opacity: 1;
}

.nv-voice-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Responsive adjustment for command bar on results page */
.nv-command-bar .nv-voice-overlay-pill {
    bottom: calc(100% + 12px);
}
