/* ============================================================================
   HERO LIVE DEMO - Premium Interactive Voice Experience
   Siri-Style Blob Animation v3.0 (Cross-Browser Compatible)
   Date: 2025-12-18

   NOTE: This version uses ONLY transform-based animations for cross-browser
   compatibility. CSS d: path() animations are NOT used (Safari incompatible).
   ============================================================================ */

/* Hero Demo Card Container Override */
.hero-demo-card {
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-live-demo-container {
    width: 100%;
    height: 100%;
    min-height: 320px;
}

/* Remove video placeholder styles when demo is active */
.hero-demo-card .player-wrapper,
.hero-demo-card .video-placeholder,
.hero-demo-card .video-play-btn {
    display: none;
}

/* Container */
.hero-demo-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* State containers */
.demo-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 24px;
    gap: 16px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIRI-STYLE BLOB - Cross-Browser Compatible
   Uses ONLY transform animations (no d: path() - Safari incompatible)
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-orb {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

/* SVG Blob Container */
.siri-blob-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.siri-blob-svg {
    width: 120px;
    height: 120px;
    overflow: visible;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
    transition: filter 0.3s ease;
}

/* Main Blob Layers - Base Styles */
.blob-layer {
    transform-origin: center center;
    /* Fill is set via inline SVG attribute for each state */
    transition: opacity 0.3s ease;
}

/* Layer 1 - Main solid layer */
.blob-layer-1 {
    animation: blobBreath1 4s ease-in-out infinite;
    opacity: 0.95;
}

/* Layer 2 - Middle blur layer */
.blob-layer-2 {
    animation: blobBreath2 5s ease-in-out infinite;
    opacity: 0.5;
    filter: blur(3px);
}

/* Layer 3 - Outer blur layer */
.blob-layer-3 {
    animation: blobBreath3 6s ease-in-out infinite;
    opacity: 0.25;
    filter: blur(6px);
}

/* Glow Layer */
.blob-glow {
    animation: blobGlow 3s ease-in-out infinite;
    /* Fill is set via inline SVG attribute */
    opacity: 0.4;
    filter: blur(10px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   IDLE STATE - Gentle Organic Breathing
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes blobBreath1 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.03) rotate(2deg);
    }
    50% {
        transform: scale(1.05) rotate(0deg);
    }
    75% {
        transform: scale(1.02) rotate(-2deg);
    }
}

@keyframes blobBreath2 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    33% {
        transform: scale(1.04) rotate(-3deg);
    }
    66% {
        transform: scale(1.03) rotate(3deg);
    }
}

@keyframes blobBreath3 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.06) rotate(5deg);
    }
}

@keyframes blobGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LISTENING STATE - Attentive, Calm Pulse
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-orb-active.orb-listening .siri-blob-svg {
    filter: drop-shadow(0 0 25px rgba(99, 102, 241, 0.5));
}

.demo-orb-active.orb-listening .blob-layer-1 {
    animation: blobListen1 2s ease-in-out infinite;
}

.demo-orb-active.orb-listening .blob-layer-2 {
    animation: blobListen2 2.5s ease-in-out infinite;
}

.demo-orb-active.orb-listening .blob-layer-3 {
    animation: blobListen3 3s ease-in-out infinite;
}

.demo-orb-active.orb-listening .blob-glow {
    animation: blobGlowListen 1.5s ease-in-out infinite;
}

@keyframes blobListen1 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

@keyframes blobListen2 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes blobListen3 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
}

@keyframes blobGlowListen {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPEAKING STATE - Active, Energetic, Dynamic
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-orb-active.orb-speaking .siri-blob-svg {
    filter: drop-shadow(0 0 35px rgba(139, 92, 246, 0.7));
}

.demo-orb-active.orb-speaking .blob-layer-1 {
    animation: blobSpeak1 0.6s ease-in-out infinite;
    /* Fill handled via inline SVG attribute */
}

.demo-orb-active.orb-speaking .blob-layer-2 {
    animation: blobSpeak2 0.8s ease-in-out infinite;
    opacity: 0.6;
}

.demo-orb-active.orb-speaking .blob-layer-3 {
    animation: blobSpeak3 1s ease-in-out infinite;
    opacity: 0.35;
}

.demo-orb-active.orb-speaking .blob-glow {
    animation: blobGlowSpeak 0.5s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes blobSpeak1 {
    0%, 100% {
        transform: scale(1) rotate(0deg) translateX(0);
    }
    25% {
        transform: scale(1.12) rotate(5deg) translateX(2px);
    }
    50% {
        transform: scale(1.18) rotate(0deg) translateX(0);
    }
    75% {
        transform: scale(1.1) rotate(-5deg) translateX(-2px);
    }
}

@keyframes blobSpeak2 {
    0%, 100% {
        transform: scale(1) rotate(0deg) translateY(0);
    }
    33% {
        transform: scale(1.15) rotate(-4deg) translateY(-3px);
    }
    66% {
        transform: scale(1.12) rotate(4deg) translateY(3px);
    }
}

@keyframes blobSpeak3 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.22) rotate(6deg);
    }
}

@keyframes blobGlowSpeak {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.3);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPECIAL STATES - Permission, Connecting, Ended, Error
   ═══════════════════════════════════════════════════════════════════════════ */

/* Permission/Waiting State */
.demo-orb-waiting .blob-layer-1,
.demo-orb-waiting .blob-layer-2,
.demo-orb-waiting .blob-layer-3 {
    animation: blobWaiting 2s ease-in-out infinite;
}

@keyframes blobWaiting {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.5;
    }
}

.orb-mic-icon {
    position: absolute;
    width: 32px;
    height: 32px;
    color: white;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Connecting State */
.demo-orb-connecting .siri-blob-svg {
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.3));
}

.demo-orb-connecting .blob-layer-1,
.demo-orb-connecting .blob-layer-2,
.demo-orb-connecting .blob-layer-3 {
    animation: blobConnecting 1.5s ease-in-out infinite;
}

@keyframes blobConnecting {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(180deg);
    }
}

.orb-spinner {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.3);
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ended State */
.demo-orb-ended .siri-blob-svg {
    filter: drop-shadow(0 0 25px rgba(16, 185, 129, 0.6));
}

.demo-orb-ended .blob-layer-1,
.demo-orb-ended .blob-layer-2,
.demo-orb-ended .blob-layer-3 {
    /* Fill (green) handled via inline SVG attribute */
    animation: blobSuccess 2s ease-in-out infinite;
}

.demo-orb-ended .blob-glow {
    opacity: 0.5;
}

@keyframes blobSuccess {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.orb-check-icon {
    position: absolute;
    width: 36px;
    height: 36px;
    color: white;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    animation: checkPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes checkPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Error State */
.demo-orb-error .siri-blob-svg {
    filter: drop-shadow(0 0 25px rgba(239, 68, 68, 0.6));
}

.demo-orb-error .blob-layer-1,
.demo-orb-error .blob-layer-2,
.demo-orb-error .blob-layer-3 {
    /* Fill (red) handled via inline SVG attribute */
    animation: blobError 0.5s ease-in-out;
}

@keyframes blobError {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.08) rotate(-5deg);
    }
    75% {
        transform: scale(1.08) rotate(5deg);
    }
}

.orb-error-icon {
    position: absolute;
    width: 32px;
    height: 32px;
    color: white;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Legacy orb-inner hidden when blob is active */
.demo-orb .orb-inner,
.demo-orb .orb-ring,
.demo-orb .orb-ring-2,
.demo-orb .orb-waveform {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEXT ELEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    letter-spacing: -0.01em;
}

[data-theme="dark"] .demo-title {
    color: #F8FAFC;
}

.demo-subtitle {
    font-size: 0.9rem;
    color: #6B7280;
    margin: 0;
    max-width: 280px;
    line-height: 1.4;
}

[data-theme="dark"] .demo-subtitle {
    color: #94A3B8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow:
        0 8px 24px rgba(99, 102, 241, 0.35),
        0 2px 8px rgba(99, 102, 241, 0.2);
}

.demo-start-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 12px 32px rgba(99, 102, 241, 0.45),
        0 4px 12px rgba(99, 102, 241, 0.3);
}

.demo-start-btn:active {
    transform: translateY(0) scale(0.98);
}

.demo-start-btn .btn-icon {
    font-size: 1.2em;
}

.demo-permission-btn {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: #6366F1;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-permission-btn:hover {
    background: #4F46E5;
    transform: translateY(-1px);
}

.demo-end-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-end-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

.demo-restart-btn,
.demo-retry-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6366F1;
    background: transparent;
    border: 1.5px solid rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-restart-btn:hover,
.demo-retry-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.6);
}

[data-theme="dark"] .demo-restart-btn,
[data-theme="dark"] .demo-retry-btn {
    color: #818CF8;
    border-color: rgba(129, 140, 248, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HINTS
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-hints {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.hint {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: #9CA3AF;
    background: rgba(156, 163, 175, 0.1);
    border-radius: 20px;
    font-style: italic;
    transition: all 0.2s ease;
}

.hint:hover {
    color: #6B7280;
    background: rgba(156, 163, 175, 0.15);
}

[data-theme="dark"] .hint {
    color: #64748B;
    background: rgba(100, 116, 139, 0.15);
}

[data-theme="dark"] .hint:hover {
    color: #94A3B8;
    background: rgba(100, 116, 139, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVE STATE ELEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
}

.demo-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #10B981;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    text-transform: uppercase;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Transcript */
.demo-transcript {
    width: 100%;
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    scroll-behavior: smooth;
}

[data-theme="dark"] .demo-transcript {
    background: rgba(255, 255, 255, 0.05);
}

.demo-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.demo-message-user {
    align-items: flex-end;
    background: rgba(99, 102, 241, 0.1);
    margin-left: 20%;
}

.demo-message-agent {
    align-items: flex-start;
    background: rgba(16, 185, 129, 0.1);
    margin-right: 20%;
}

.message-role {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9CA3AF;
    margin-bottom: 2px;
}

.demo-message-user .message-role {
    color: #6366F1;
}

.demo-message-agent .message-role {
    color: #10B981;
}

.message-text {
    font-size: 0.85rem;
    color: #374151;
    line-height: 1.4;
}

[data-theme="dark"] .message-text {
    color: #E2E8F0;
}

/* Status indicator */
.demo-status-indicator {
    font-size: 0.8rem;
    color: #6B7280;
    margin: 0;
}

.status-listening {
    color: #6366F1;
}

.status-speaking {
    color: #8B5CF6;
}

/* Status text */
.demo-status-text,
.demo-permission-text,
.demo-error-text,
.demo-ended-text {
    font-size: 0.9rem;
    color: #6B7280;
    margin: 0;
}

[data-theme="dark"] .demo-status-text,
[data-theme="dark"] .demo-permission-text,
[data-theme="dark"] .demo-error-text,
[data-theme="dark"] .demo-ended-text {
    color: #94A3B8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENDED STATE CTA
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-cta-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    margin: 8px 0;
}

.demo-cta-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

[data-theme="dark"] .demo-cta-text {
    color: #E2E8F0;
}

.demo-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.demo-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .demo-orb {
        width: 100px;
        height: 100px;
    }

    .siri-blob-svg {
        width: 100px;
        height: 100px;
    }

    .demo-title {
        font-size: 1.1rem;
    }

    .demo-start-btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    .demo-hints {
        flex-direction: column;
    }

    .demo-transcript {
        max-height: 100px;
    }

    .demo-message {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR STYLING
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-transcript::-webkit-scrollbar {
    width: 4px;
}

.demo-transcript::-webkit-scrollbar-track {
    background: transparent;
}

.demo-transcript::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 2px;
}

.demo-transcript::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}
