/* onboarding.css — primera ejecución de MEDUSA: welcome + birth (conversación).
   Estética cinematográfica: fondo negro con vignette, orbe palpitante,
   transiciones suaves. */

html.onb-locked, body.onb-locked {
    overflow: hidden !important;
}

.onb-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: rgba(255, 255, 255, 0.92);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.onb-overlay.onb-visible { opacity: 1; }
.onb-overlay.onb-fade-out { opacity: 0; transition: opacity 0.6s ease; }

.onb-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, rgba(80, 130, 255, 0.10) 0%, rgba(0, 0, 0, 0) 60%),
        #050810;
    pointer-events: none;
}

/* ──────── Welcome (palabra clave Bienvenida) ──────── */

.onb-welcome-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 36px;
    max-width: 560px;
    padding: 24px;
}

.onb-orb-sleep {
    position: relative;
    width: 180px;
    height: 180px;
}
.onb-orb-core {
    position: absolute;
    inset: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(120, 180, 255, 0.35) 0%, rgba(60, 80, 140, 0.10) 60%, transparent 100%);
    animation: onbBreathe 4s ease-in-out infinite;
}
.onb-orb-halo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(120, 180, 255, 0.20);
    animation: onbBreathe 4s ease-in-out infinite;
    animation-delay: 0.5s;
}
@keyframes onbBreathe {
    0%, 100% { transform: scale(0.92); opacity: 0.55; }
    50%      { transform: scale(1.04); opacity: 0.85; }
}

/* Despertar */
.onb-welcome.onb-waking .onb-orb-core {
    animation: onbWake 1.2s ease-out forwards;
}
.onb-welcome.onb-waking .onb-orb-halo {
    animation: onbWakeHalo 1.2s ease-out forwards;
}
@keyframes onbWake {
    0% { background: radial-gradient(circle, rgba(120, 180, 255, 0.35) 0%, transparent 100%); transform: scale(1); }
    100% { background: radial-gradient(circle, rgba(180, 230, 255, 1) 0%, rgba(80, 140, 220, 0.7) 50%, transparent 100%); transform: scale(1.4); }
}
@keyframes onbWakeHalo {
    0% { transform: scale(1); opacity: 0.6; border-color: rgba(120, 180, 255, 0.4); }
    100% { transform: scale(1.6); opacity: 0; border-color: rgba(180, 230, 255, 0.9); }
}

.onb-welcome-text { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.onb-zzz {
    font-size: 11px;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: 0.45;
    margin: 0;
    animation: onbZzzFade 3s ease-in-out infinite;
}
@keyframes onbZzzFade {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.6; }
}
.onb-welcome-title {
    margin: 0;
    font-size: 44px;
    font-weight: 200;
    letter-spacing: 6px;
    color: rgba(220, 235, 255, 0.95);
    text-shadow: 0 0 24px rgba(120, 180, 255, 0.4);
}
.onb-welcome-sub {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    max-width: 420px;
}
.onb-welcome-sub strong {
    color: rgba(180, 230, 255, 1);
    font-weight: 600;
    letter-spacing: 1px;
}

/* Botón "Despertar" — único disparador del nacimiento */
.onb-btn-wake {
    margin-top: 12px;
    padding: 14px 36px;
    font-size: 15px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(120, 180, 255, 0.25);
}
.onb-btn-wake:hover:not(:disabled) {
    box-shadow: 0 8px 28px rgba(120, 180, 255, 0.45);
    transform: translateY(-1px);
}

/* ──────── Birth: conversación natural por voz ──────── */

.onb-birth-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: 720px;
    padding: 32px 24px;
    text-align: center;
}

.onb-birth-orb {
    position: relative;
    width: 240px;
    height: 240px;
}
.onb-birth-orb .onb-orb-core {
    inset: 70px;
    background: radial-gradient(circle,
        rgba(180, 220, 255, 0.55) 0%,
        rgba(80, 140, 220, 0.18) 60%,
        transparent 100%);
    animation: onbBreathe 3.6s ease-in-out infinite;
    transition: background 0.6s ease, transform 0.4s ease;
}
.onb-birth-orb .onb-orb-halo {
    border: 1px solid rgba(120, 180, 255, 0.30);
    animation: onbBreathe 3.6s ease-in-out infinite;
    animation-delay: 0.4s;
}
.onb-birth-orb[data-state="speaking"] .onb-orb-core {
    background: radial-gradient(circle,
        rgba(180, 230, 255, 0.85) 0%,
        rgba(76, 167, 255, 0.35) 55%,
        transparent 100%);
    animation: onbOrbSpeak 1.1s ease-in-out infinite;
}
.onb-birth-orb[data-state="listening"] .onb-orb-core {
    background: radial-gradient(circle,
        rgba(180, 255, 210, 0.78) 0%,
        rgba(80, 220, 130, 0.28) 55%,
        transparent 100%);
    animation: onbBreathe 2.2s ease-in-out infinite;
}
.onb-birth-orb[data-state="thinking"] .onb-orb-core {
    background: radial-gradient(circle,
        rgba(255, 230, 160, 0.65) 0%,
        rgba(255, 211, 80, 0.20) 55%,
        transparent 100%);
    animation: onbBreathe 2.8s ease-in-out infinite;
}
.onb-birth-orb[data-state="done"] .onb-orb-core {
    background: radial-gradient(circle,
        rgba(220, 240, 255, 1) 0%,
        rgba(120, 180, 255, 0.55) 50%,
        transparent 100%);
    transform: scale(1.15);
}
@keyframes onbOrbSpeak {
    0%, 100% { transform: scale(0.96); }
    50%      { transform: scale(1.10); }
}

.onb-birth-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    letter-spacing: 0.5px;
}
.onb-birth-status .onb-birth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: onbStatusPulse 1.2s ease-in-out infinite;
}
.onb-birth-status[data-state="speaking"] {
    border-color: rgba(76, 167, 255, 0.45);
    box-shadow: 0 0 22px rgba(76, 167, 255, 0.28);
}
.onb-birth-status[data-state="speaking"] .onb-birth-dot {
    background: #4ca7ff;
    box-shadow: 0 0 10px #4ca7ff;
}
.onb-birth-status[data-state="listening"] {
    border-color: rgba(80, 220, 130, 0.45);
    box-shadow: 0 0 22px rgba(80, 220, 130, 0.28);
}
.onb-birth-status[data-state="listening"] .onb-birth-dot {
    background: #50dc82;
    box-shadow: 0 0 10px #50dc82;
}
.onb-birth-status[data-state="thinking"] {
    border-color: rgba(255, 211, 80, 0.45);
    box-shadow: 0 0 22px rgba(255, 211, 80, 0.28);
}
.onb-birth-status[data-state="thinking"] .onb-birth-dot {
    background: #ffd350;
    box-shadow: 0 0 10px #ffd350;
}
.onb-birth-status[data-state="done"] {
    border-color: rgba(180, 230, 255, 0.55);
    box-shadow: 0 0 24px rgba(180, 230, 255, 0.35);
}
.onb-birth-status[data-state="done"] .onb-birth-dot {
    background: #fff;
    box-shadow: 0 0 12px #fff;
    animation: none;
}
@keyframes onbStatusPulse {
    0%, 100% { transform: scale(1);   opacity: 0.7; }
    50%      { transform: scale(1.4); opacity: 1; }
}

.onb-birth-subtitle {
    margin: 0;
    font-size: 22px;
    font-weight: 300;
    line-height: 1.45;
    letter-spacing: 0.3px;
    color: rgba(230, 240, 255, 0.95);
    min-height: 64px;
    max-width: 600px;
    text-shadow: 0 0 24px rgba(80, 140, 220, 0.25);
    animation: onbSubFade 0.5s ease;
}
@keyframes onbSubFade {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
.onb-birth-hint {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.45);
    max-width: 480px;
    line-height: 1.5;
}
.onb-birth-error {
    margin-top: 8px;
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 100, 100, 0.4);
    background: rgba(120, 30, 30, 0.18);
    color: rgba(255, 200, 200, 0.95);
    font-size: 13px;
    line-height: 1.5;
    max-width: 540px;
}

/* Hint sutil de push-to-talk (espacio) bajo el subtítulo cuando está
   escuchando. Solo en onboarding (no contamina el chat). */
.onb-ptt-hint {
    margin: 4px 0 0 0;
    font-size: 11px;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    line-height: 1.4;
    max-width: 540px;
}
.onb-ptt-hint.is-visible { opacity: 0.55; }
.onb-ptt-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    margin: 0 2px;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 1px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
}
/* Mientras se está grabando push-to-talk, lo destacamos un poco. */
.onb-birth-status[data-state="listening"][data-source="push"] .onb-birth-status-text {
    color: rgba(255, 210, 130, 0.95);
}

/* ──────── Birth bloqueado: ElevenLabs no configurado ──────── */

.onb-birth-blocked {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
    max-width: 560px;
    padding: 24px;
}
.onb-orb-blocked .onb-orb-core {
    background: radial-gradient(circle,
        rgba(255, 180, 120, 0.4) 0%,
        rgba(180, 80, 40, 0.10) 60%,
        transparent 100%);
}
.onb-orb-blocked .onb-orb-halo {
    border-color: rgba(255, 180, 120, 0.30);
}
.onb-birth-title {
    margin: 0;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: rgba(230, 240, 255, 0.95);
}
.onb-birth-sub {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
}
.onb-birth-sub strong {
    color: rgba(180, 230, 255, 1);
    font-weight: 500;
}
.onb-birth-missing {
    margin: 0;
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 0.4px;
}
.onb-birth-missing code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    margin: 0 2px;
}
.onb-birth-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}

/* Botones (compartidos welcome + birth-blocked) */
.onb-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.onb-btn-primary {
    background: linear-gradient(180deg, rgba(120, 180, 255, 0.9), rgba(80, 140, 220, 0.9));
    color: #001220;
    border-color: rgba(180, 230, 255, 0.85);
}
.onb-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(120, 180, 255, 0.35);
}
.onb-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.onb-btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.12);
}
.onb-btn-ghost:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.04);
}

/* ──────── Móvil ──────── */
@media (max-width: 640px) {
    .onb-welcome-title { font-size: 32px; letter-spacing: 4px; }
    .onb-orb-sleep { width: 140px; height: 140px; }
    .onb-orb-core { inset: 46px; }
    .onb-birth-stage { padding: 20px 16px; gap: 22px; }
    .onb-birth-orb { width: 180px; height: 180px; }
    .onb-birth-orb .onb-orb-core { inset: 54px; }
    .onb-birth-subtitle { font-size: 18px; min-height: 54px; }
    .onb-birth-title { font-size: 22px; }
}
