/**
 * OXORA Landing V2 — Fase 2.2: IA em Tempo Real
 * Componentes: OxLiveDashboard, OxPhoneDemo, OxAutomationCard,
 *              OxAIPipeline, OxStatCard, OxGlowPanel
 */

/* ── Section shell ── */
.ox-lv2-live-ai {
    position: relative;
    padding: clamp(4rem, 8vw, 6rem) var(--ox-space-6);
    overflow: hidden;
    isolation: isolate;
}

.ox-lv2-live-ai-inner {
    position: relative;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
}

.ox-lv2-live-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: clamp(2.5rem, 5vw, 4rem);
    align-items: center;
}

/* Background */
.ox-lv2-live-ai-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.ox-lv2-live-ai-aurora {
    position: absolute;
    inset: -10%;
    background:
        radial-gradient(ellipse 50% 40% at 70% 30%, rgba(155, 61, 255, 0.15), transparent 55%),
        radial-gradient(ellipse 45% 35% at 20% 70%, rgba(45, 140, 255, 0.12), transparent 50%);
    animation: ox-lv2-aurora-shift 20s ease-in-out infinite alternate;
}

.ox-lv2-live-ai-mesh {
    position: absolute;
    inset: 0;
    opacity: 0.25;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 15%, transparent 70%);
}

.ox-lv2-live-ai-noise {
    position: absolute;
    inset: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ox-lv2-live-blob-a {
    width: 400px;
    height: 400px;
    top: 10%;
    right: -8%;
    animation: ox-lv2-blob-drift-a 24s ease-in-out infinite;
}

.ox-lv2-live-blob-b {
    width: 350px;
    height: 350px;
    bottom: 5%;
    left: -6%;
    animation: ox-lv2-blob-drift-b 28s ease-in-out infinite;
}

/* Copy column */
.ox-lv2-live-title {
    margin: var(--ox-space-4) 0 var(--ox-space-5);
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.ox-lv2-live-sub {
    margin: 0 0 var(--ox-space-8);
    max-width: 520px;
}

/* OxAutomationCard */
.ox-lv2-automation-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ox-space-3);
    margin-bottom: var(--ox-space-8);
    list-style: none;
    padding: 0;
}

.ox-lv2-automation-card {
    display: flex;
    gap: var(--ox-space-3);
    padding: var(--ox-space-4);
    border-radius: var(--ox-radius-sm);
    cursor: default;
    transition: transform 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}

.ox-lv2-automation-card.is-active {
    border-color: rgba(155, 61, 255, 0.35);
    box-shadow: var(--ox-glow-purple);
}

.ox-lv2-automation-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(155, 61, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--ox-purple);
    transition: transform 280ms ease, box-shadow 280ms ease;
}

.ox-lv2-automation-card:hover .ox-lv2-automation-card-icon,
.ox-lv2-automation-card.is-active .ox-lv2-automation-card-icon {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(155, 61, 255, 0.25);
}

.ox-lv2-automation-card-icon svg { width: 18px; height: 18px; }

.ox-lv2-automation-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    color: var(--ox-text);
}

.ox-lv2-automation-card-desc {
    font-size: 0.72rem;
    line-height: 1.5;
    margin: 0;
    color: var(--ox-text-tertiary);
}

/* Benefits */
.ox-lv2-live-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--ox-space-8);
    display: flex;
    flex-direction: column;
    gap: var(--ox-space-3);
}

.ox-lv2-live-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--ox-text-secondary);
}

.ox-lv2-live-benefits svg {
    width: 18px;
    height: 18px;
    color: var(--ox-purple);
    flex-shrink: 0;
    margin-top: 2px;
}

/* OxStatCard */
.ox-lv2-stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ox-space-3);
}

.ox-lv2-stat-card {
    padding: var(--ox-space-4);
    border-radius: var(--ox-radius-sm);
    text-align: center;
}

.ox-lv2-stat-card-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    background: var(--ox-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ox-lv2-stat-card-label {
    display: block;
    font-size: 0.65rem;
    color: var(--ox-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ── OxGlowPanel + stage ── */
.ox-lv2-glow-panel {
    position: relative;
    border-radius: var(--ox-radius-card);
    border: 1px solid var(--ox-border);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    box-shadow: var(--ox-shadow-lg);
    overflow: hidden;
    min-height: 480px;
}

.ox-lv2-glow-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(155, 61, 255, 0.08), transparent 50%);
    pointer-events: none;
    transition: opacity 300ms ease;
    opacity: 0;
}

.ox-lv2-glow-panel:hover::before { opacity: 1; }

.ox-lv2-live-scene-wrap {
    padding: var(--ox-space-6);
}

.ox-lv2-live-scene-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--ox-success);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.2);
    transition: opacity 300ms ease;
}

/* Toasts (Sim 4) */
.ox-lv2-live-toasts {
    position: absolute;
    top: var(--ox-space-4);
    right: var(--ox-space-4);
    z-index: 10;
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.ox-lv2-live-toast {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--ox-text);
    background: rgba(5, 8, 22, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 999px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.ox-lv2-live-toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.ox-lv2-live-toast svg {
    width: 14px;
    height: 14px;
    color: var(--ox-success);
}

/* ── OxLiveDashboard ── */
.ox-lv2-live-dashboard {
    position: relative;
    z-index: 2;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, #141929, #0a0e1a);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    transition: transform 400ms ease, box-shadow 400ms ease;
}

.ox-lv2-live-dashboard.is-updating {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), var(--ox-glow-purple);
}

.ox-lv2-live-dash-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--ox-border);
    font-size: 0.6rem;
}

.ox-lv2-live-dash-bar > span:nth-child(1) { background: rgba(239,68,68,0.6); width:8px;height:8px;border-radius:50%; }
.ox-lv2-live-dash-bar > span:nth-child(2) { background: rgba(251,191,36,0.6); width:8px;height:8px;border-radius:50%; }
.ox-lv2-live-dash-bar > span:nth-child(3) { background: rgba(52,211,153,0.6); width:8px;height:8px;border-radius:50%; }

.ox-lv2-live-dash-url {
    margin-left: 8px;
    color: var(--ox-text-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
}

.ox-lv2-live-dash-live {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--ox-success);
    font-weight: 600;
}

.ox-lv2-live-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ox-success);
    animation: ox-lv2-pulse-glow 2s ease-in-out infinite;
}

.ox-lv2-live-dash-body {
    display: grid;
    grid-template-columns: 40px 1fr;
    min-height: 260px;
}

.ox-lv2-live-dash-sidebar {
    padding: 10px 6px;
    border-right: 1px solid var(--ox-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ox-lv2-live-dash-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--ox-gradient);
    margin-bottom: 4px;
}

.ox-lv2-live-dash-nav {
    height: 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
}

.ox-lv2-live-dash-main { padding: 12px; }

.ox-lv2-live-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.ox-lv2-live-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.ox-lv2-live-kpi {
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.55rem;
    transition: transform 400ms ease, box-shadow 400ms ease, border-color 400ms ease;
}

.ox-lv2-live-kpi span {
    display: block;
    color: var(--ox-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.ox-lv2-live-kpi strong {
    font-size: 0.8rem;
    color: var(--ox-text);
    transition: color 400ms ease;
}

.ox-lv2-live-kpi.is-flash {
    transform: scale(1.04);
    border-color: rgba(155, 61, 255, 0.4);
    box-shadow: var(--ox-glow-purple);
}

.ox-lv2-live-kpi.is-flash strong {
    color: var(--ox-purple);
}

.ox-lv2-live-panels {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 6px;
}

.ox-lv2-live-panel {
    padding: 8px;
    border-radius: 8px;
    min-height: 90px;
}

.ox-lv2-live-panel-title {
    display: block;
    font-size: 0.55rem;
    color: var(--ox-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.ox-lv2-live-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 56px;
}

.ox-lv2-live-bar {
    flex: 1;
    height: var(--h, 40%);
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, var(--ox-purple), var(--ox-blue));
    opacity: 0.8;
    transition: height 800ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 400ms ease;
}

.ox-lv2-live-bar.is-boost { opacity: 1; filter: brightness(1.15); }

.ox-lv2-live-agenda {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ox-lv2-live-agenda li {
    font-size: 0.55rem;
    color: var(--ox-text-secondary);
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    gap: 6px;
}

.ox-lv2-live-agenda time {
    color: var(--ox-purple);
    font-weight: 600;
    min-width: 32px;
}

.ox-lv2-live-agenda-new {
    animation: ox-lv2-rise 500ms ease forwards;
    color: var(--ox-success) !important;
}

#ox-lv2-agenda-panel.is-highlight {
    border-color: rgba(52, 211, 153, 0.35);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

/* OxAIPipeline */
.ox-lv2-ai-pipeline {
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
}

.ox-lv2-pipeline-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ox-lv2-pipeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--ox-text-tertiary);
    opacity: 0.4;
    transition: opacity 400ms ease, color 400ms ease, transform 400ms ease;
}

.ox-lv2-pipeline-step.is-active {
    opacity: 1;
    color: var(--ox-text);
    transform: translateX(4px);
}

.ox-lv2-pipeline-step.is-done {
    opacity: 1;
    color: var(--ox-success);
}

.ox-lv2-pipeline-step.is-done .ox-lv2-pipeline-icon {
    background: rgba(52, 211, 153, 0.15);
    color: var(--ox-success);
}

.ox-lv2-pipeline-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(155, 61, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ox-purple);
}

.ox-lv2-pipeline-icon svg { width: 12px; height: 12px; }

.ox-lv2-pipeline-step.is-active .ox-lv2-pipeline-icon {
    animation: ox-lv2-pulse-glow 1.5s ease-in-out infinite;
}

/* ── OxPhoneDemo ── */
.ox-lv2-phone-demo {
    position: absolute;
    right: var(--ox-space-4);
    bottom: var(--ox-space-4);
    width: 140px;
    z-index: 4;
    padding: 6px;
    border-radius: 22px;
    background: linear-gradient(160deg, #2a3148, #12192d);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), var(--ox-glow);
    transition: transform 400ms ease, box-shadow 400ms ease;
}

.ox-lv2-phone-demo.is-active {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), var(--ox-glow-purple);
    transform: translateY(-4px);
}

.ox-lv2-phone-demo-notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.ox-lv2-phone-demo-screen {
    border-radius: 16px;
    overflow: hidden;
    background: var(--ox-bg-secondary);
    border: 1px solid var(--ox-border);
}

.ox-lv2-phone-demo-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 18px 8px 8px;
    font-size: 0.55rem;
    font-weight: 600;
    background: rgba(155, 61, 255, 0.1);
    border-bottom: 1px solid var(--ox-border);
}

.ox-lv2-phone-demo-header svg { width: 12px; height: 12px; color: var(--ox-purple); }

.ox-lv2-phone-online {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ox-success);
    margin-left: auto;
    box-shadow: 0 0 6px var(--ox-success);
}

.ox-lv2-phone-demo-chat {
    padding: 8px;
    min-height: 140px;
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: none;
}

.ox-lv2-phone-demo-chat::-webkit-scrollbar { display: none; }

.ox-lv2-chat-bubble {
    font-size: 0.48rem;
    line-height: 1.45;
    padding: 5px 7px;
    border-radius: 8px;
    max-width: 92%;
    opacity: 0;
    transform: translateY(8px);
    animation: ox-lv2-chat-in 400ms ease forwards;
}

@keyframes ox-lv2-chat-in {
    to { opacity: 1; transform: translateY(0); }
}

.ox-lv2-chat-bubble--client {
    align-self: flex-start;
    background: var(--ox-glass);
    color: var(--ox-text-secondary);
}

.ox-lv2-chat-bubble--ia {
    align-self: flex-end;
    background: rgba(155, 61, 255, 0.18);
    color: var(--ox-text);
    border: 1px solid rgba(155, 61, 255, 0.2);
}

.ox-lv2-chat-bubble--confirm {
    align-self: flex-end;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--ox-success);
}

.ox-lv2-chat-bubble-role {
    display: block;
    font-size: 0.4rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 2px;
}

.ox-lv2-phone-typing {
    display: flex;
    gap: 3px;
    padding: 4px 8px 8px;
    align-self: flex-end;
    margin-left: auto;
    width: fit-content;
}

.ox-lv2-phone-typing span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ox-purple);
    animation: ox-lv2-typing 1.2s ease-in-out infinite;
}

.ox-lv2-phone-typing span:nth-child(2) { animation-delay: 0.15s; }
.ox-lv2-phone-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ox-lv2-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Sync line */
.ox-lv2-live-sync {
    position: absolute;
    left: 50%;
    bottom: 28%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    transition: opacity 400ms ease;
}

.ox-lv2-live-sync.is-visible { opacity: 0.6; }

.ox-lv2-sync-line {
    stroke: var(--ox-purple);
    stroke-width: 1.5;
    stroke-dasharray: 6 12;
    opacity: 0.5;
}

.ox-lv2-sync-pulse {
    fill: var(--ox-purple);
    animation: ox-lv2-pulse-glow 2s ease-in-out infinite;
}

/* Scene states */
.ox-lv2-live-scene-wrap[data-scene="chat"] .ox-lv2-phone-demo { z-index: 5; }
.ox-lv2-live-scene-wrap[data-scene="dashboard"] .ox-lv2-live-dashboard { transform: scale(1.02); }
.ox-lv2-live-scene-wrap[data-scene="campaign"] .ox-lv2-live-panels { opacity: 0.35; }
.ox-lv2-live-scene-wrap[data-scene="indicators"] .ox-lv2-live-toasts { z-index: 15; }

/* Card tilt hover */
.ox-lv2-automation-card[data-tilt] {
    transform-style: preserve-3d;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .ox-lv2-live-grid {
        grid-template-columns: 1fr;
    }

    .ox-lv2-live-stage { order: -1; }

    .ox-lv2-glow-panel { min-height: 420px; }

    .ox-lv2-automation-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ox-lv2-live-ai { padding: var(--ox-space-12) var(--ox-space-4); }

    .ox-lv2-automation-cards { grid-template-columns: 1fr; }

    .ox-lv2-stat-cards { grid-template-columns: 1fr; }

    .ox-lv2-live-scene-wrap {
        padding: var(--ox-space-4);
        display: flex;
        flex-direction: column;
        gap: var(--ox-space-4);
        min-height: auto;
    }

    .ox-lv2-live-dashboard {
        position: relative;
        order: 1;
    }

    .ox-lv2-phone-demo {
        position: relative;
        right: auto;
        bottom: auto;
        width: 160px;
        margin: 0 auto;
        order: 2;
    }

    .ox-lv2-live-sync { display: none; }

    .ox-lv2-live-kpis { grid-template-columns: repeat(2, 1fr); }

    .ox-lv2-live-panels { grid-template-columns: 1fr; }

    .ox-lv2-live-toasts {
        position: relative;
        top: auto;
        right: auto;
        order: 3;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ox-lv2-live-ai-aurora,
    .ox-lv2-live-blob-a,
    .ox-lv2-live-blob-b,
    .ox-lv2-live-pulse-dot,
    .ox-lv2-phone-typing span,
    .ox-lv2-chat-bubble {
        animation: none !important;
    }

    .ox-lv2-chat-bubble { opacity: 1; transform: none; }
}
