/* Voice Assistant shortcode – speech in/out, knowledge base + WooCommerce */
.kb-voice-assistant-wrap {
    --kb-va-bg: #0f172a;
    --kb-va-surface: #1e293b;
    --kb-va-border: #334155;
    --kb-va-accent: #38bdf8;
    --kb-va-text: #f1f5f9;
    --kb-va-muted: #94a3b8;
    --kb-va-recording: #f87171;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 420px;
    margin: 0 auto;
    background: var(--kb-va-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    padding: 24px;
}

.kb-voice-assistant-header {
    text-align: center;
    margin-bottom: 20px;
}

.kb-voice-assistant-title {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kb-va-text);
}

.kb-voice-assistant-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--kb-va-muted);
    line-height: 1.4;
}

.kb-voice-assistant-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.kb-voice-assistant-actions {
    display: flex;
    justify-content: center;
}

.kb-voice-assistant-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: var(--kb-va-accent);
    color: var(--kb-va-bg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
}

.kb-voice-assistant-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
}

.kb-voice-assistant-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.kb-voice-assistant-btn.kb-voice-assistant-recording {
    background: var(--kb-va-recording);
    color: #fff;
    box-shadow: 0 4px 14px rgba(248, 113, 113, 0.5);
    animation: kb-va-pulse 1.2s ease-in-out infinite;
}

@keyframes kb-va-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.kb-voice-assistant-btn-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kb-voice-assistant-hint {
    margin: 0;
    font-size: 12px;
    color: var(--kb-va-muted);
    text-align: center;
    max-width: 280px;
}

/* Real-time mode: active = connected */
.kb-voice-realtime-wrap .kb-voice-realtime-btn.kb-voice-realtime-active {
    background: #22c55e;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.5);
}
.kb-voice-realtime-wrap .kb-voice-realtime-btn.kb-voice-realtime-active:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

/* Spline 3D realtime UI */
.kb-voice-realtime-spline-wrap {
    max-width: 100%;
    width: 100%;
    padding: 0;
    min-height: 0;
}
.kb-voice-realtime-spline-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    background: var(--kb-va-bg, #0f172a);
    border-radius: 16px;
    overflow: hidden;
}
.kb-voice-realtime-spline-container spline-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.kb-voice-realtime-spline-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 2;
}
.kb-voice-realtime-spline-trigger.kb-voice-realtime-active {
    cursor: pointer;
}
/* Hide Spline "Built with Spline" branding (badge is usually bottom-right) */
.kb-voice-realtime-spline-branding-cover {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 140px;
    height: 32px;
    background: var(--kb-va-bg, #0f172a);
    pointer-events: none;
    z-index: 1;
}
/* Visual state: assistant stopped (default) */
.kb-voice-realtime-spline-container {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    border: 3px solid transparent;
    border-radius: 16px;
}
.kb-voice-realtime-spline-container:not(.kb-voice-realtime-active) {
    box-shadow: none;
}
/* Visual state: assistant started (listening/speaking) – very obvious */
.kb-voice-realtime-spline-container.kb-voice-realtime-active {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e, 0 0 20px rgba(34, 197, 94, 0.6), inset 0 0 40px rgba(34, 197, 94, 0.08);
    animation: kb-voice-realtime-pulse 2s ease-in-out infinite;
}
@keyframes kb-voice-realtime-pulse {
    0%, 100% { box-shadow: 0 0 0 1px #22c55e, 0 0 20px rgba(34, 197, 94, 0.6), inset 0 0 40px rgba(34, 197, 94, 0.08); }
    50%  { box-shadow: 0 0 0 2px #22c55e, 0 0 28px rgba(34, 197, 94, 0.8), inset 0 0 50px rgba(34, 197, 94, 0.12); }
}
/* Status badge: "Listening" when active, hidden when stopped */
.kb-voice-realtime-status {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    background: #22c55e;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.kb-voice-realtime-status.kb-voice-realtime-status-visible {
    opacity: 1;
    visibility: visible;
}
.kb-voice-realtime-status.kb-voice-realtime-status-visible::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: kb-voice-realtime-dot 1s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes kb-voice-realtime-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%  { opacity: 0.5; transform: scale(0.85); }
}

@media (max-width: 480px) {
    .kb-voice-assistant-wrap {
        margin: 0 12px;
        padding: 20px;
    }
    .kb-voice-assistant-btn {
        width: 72px;
        height: 72px;
    }
    .kb-voice-assistant-btn svg {
        width: 28px;
        height: 28px;
    }
}
