/* ============================================
   P.A.M. Command Center v2.1 — Voice Overlay
   Fullscreen immersive conversation mode
   Uses CSS variables from main.css for theming
   ============================================ */

/* === OVERLAY CONTAINER === */
#voiceOverlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#voiceOverlay.vo-active {
    opacity: 1;
    pointer-events: all;
}

/* Background blur */
.vo-bg {
    position: absolute;
    inset: 0;
    background: rgba(8, 5, 16, 0.94);
    backdrop-filter: blur(30px);
}

/* Content wrapper */
.vo-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

/* === ORB === */
.vo-orb-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vo-orb {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--purple), var(--pink), var(--cyan), var(--purple));
    animation: vo-orb-spin 6s linear infinite;
    box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(139, 92, 246, 0.1);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    position: relative;
}

.vo-orb::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(20, 10, 40, 0.4), var(--bg-dark) 70%);
}

.vo-orb::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 180deg, transparent 40%, var(--accent-glow) 50%, transparent 60%);
    animation: vo-orb-spin 4s linear infinite reverse;
    filter: blur(10px);
}

/* Orb states */
.vo-orb.vo-listening {
    animation: vo-orb-spin 6s linear infinite, vo-breath 3s ease-in-out infinite;
}

.vo-orb.vo-hearing {
    animation: vo-orb-spin 4s linear infinite, vo-hear 0.5s ease-in-out infinite;
}

.vo-orb.vo-thinking {
    animation: vo-orb-spin 2s linear infinite;
    filter: brightness(1.3);
    box-shadow: 0 0 60px var(--accent-dim), 0 0 120px var(--accent-glow);
}

.vo-orb.vo-speaking {
    animation: vo-orb-spin 3s linear infinite, vo-speak 0.8s ease-in-out infinite;
    box-shadow: 0 0 50px var(--accent-dim), 0 0 100px var(--accent-glow);
}

/* === RINGS === */
.vo-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: vo-ring-expand 3s ease-out infinite;
}

.vo-r1 { width: 160px; height: 160px; animation-delay: 0s; }
.vo-r2 { width: 160px; height: 160px; animation-delay: 1s; }
.vo-r3 { width: 160px; height: 160px; animation-delay: 2s; }

/* Only animate rings when active */
[data-voice-state="idle"] .vo-ring { animation-play-state: paused; opacity: 0; }

/* === STATUS === */
.vo-status {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    min-height: 18px;
    transition: color 0.3s;
}

/* === TRANSCRIPT === */
.vo-transcript {
    font-family: var(--font-ui);
    font-size: 18px;
    color: var(--text-primary);
    text-align: center;
    min-height: 28px;
    max-width: 360px;
    line-height: 1.4;
    opacity: 0.9;
}

/* === CONTROLS === */
.vo-controls {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    align-items: center;
}

.vo-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(8px);
}

.vo-btn:hover {
    border-color: var(--border-hover);
    background: var(--accent-subtle);
    color: var(--accent-light);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: scale(1.05);
}

.vo-btn-main {
    width: 64px;
    height: 64px;
    font-size: 24px;
    background: var(--accent-glow);
    border-color: var(--border-hover);
}

.vo-btn-main:hover {
    background: var(--accent-dim);
    box-shadow: 0 0 25px var(--accent-glow);
}

/* Mic pulse when listening */
[data-voice-state="listening"] .vo-btn-main,
[data-voice-state="hearing"] .vo-btn-main {
    animation: vo-mic-pulse 2s ease-in-out infinite;
    border-color: var(--accent-dim);
}

/* === HINT === */
.vo-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* === KEYFRAMES === */
@keyframes vo-orb-spin {
    to { transform: rotate(360deg); }
}

@keyframes vo-breath {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.04); }
}

@keyframes vo-hear {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.15); }
}

@keyframes vo-speak {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    25% { transform: scale(1.07); filter: brightness(1.2); }
    50% { transform: scale(0.96); filter: brightness(1.1); }
    75% { transform: scale(1.04); filter: brightness(1.15); }
}

@keyframes vo-ring-expand {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

@keyframes vo-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-dim); }
    50% { box-shadow: 0 0 0 14px transparent; }
}

/* === VOICE MODE: dim background === */
body.voice-mode-active .topbar,
body.voice-mode-active .sidebar,
body.voice-mode-active .content-area {
    filter: blur(3px);
    opacity: 0.3;
    pointer-events: none;
    transition: all 0.4s ease;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .vo-orb-wrap { width: 160px; height: 160px; }
    .vo-orb { width: 110px; height: 110px; }
    .vo-transcript { font-size: 16px; max-width: 280px; }
}
