/* ============================================================
   Onboarding / Tour guiado do primeiro acesso
   JS/CSS puro, sem dependências externas (funciona offline no APK/PWA)
   ============================================================ */

.ob-root {
    position: fixed;
    inset: 0;
    z-index: 2000000;
    pointer-events: none;
}

.ob-root.ob-active {
    /* A camada não pode capturar cliques: o spotlight é só um box-shadow,
       não abre buraco real. Deixamos os eventos passarem para o app (para
       digitar no perfil e clicar em Salvar); só o balão e o backdrop
       (quando não há alvo) reativam pointer-events. */
    pointer-events: none;
}

/* Camada escura + recorte (spotlight) sobre o elemento-alvo */
.ob-spotlight {
    position: absolute;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(10, 14, 25, 0.78);
    transition: all 0.25s ease;
    pointer-events: none;
}

.ob-spotlight.ob-pulse {
    animation: obPulse 1.6s ease-in-out infinite;
}

/* Fase obrigatória: escurecimento mais leve p/ o formulário continuar legível */
.ob-spotlight.ob-soft {
    box-shadow: 0 0 0 9999px rgba(10, 14, 25, 0.45);
}

@keyframes obPulse {
    0%, 100% { outline: 3px solid rgba(255, 193, 7, 0.9); outline-offset: 2px; }
    50%      { outline: 3px solid rgba(255, 193, 7, 0.25); outline-offset: 6px; }
}

/* Quando não há alvo, escurece a tela inteira */
.ob-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 25, 0.78);
    pointer-events: auto; /* só aparece quando não há alvo: bloqueia como modal */
}

/* Balão com o texto do passo */
.ob-balloon {
    position: absolute;
    width: min(340px, calc(100vw - 32px));
    background: #fff;
    color: #1c2431;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    padding: 18px 18px 14px;
    z-index: 2000001;
    transition: all 0.25s ease;
    pointer-events: auto; /* botões do balão precisam receber clique */
}

.ob-balloon .ob-step-count {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c99700;
}

.ob-balloon .ob-title {
    font-size: 17px;
    font-weight: 800;
    margin: 4px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #101826;
}

.ob-balloon .ob-title i {
    color: #c99700;
}

.ob-balloon .ob-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: #3a4453;
    margin-bottom: 14px;
}

/* Barra de progresso */
.ob-progress {
    height: 4px;
    background: #eef1f5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}

.ob-progress > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f0c040, #c99700);
    transition: width 0.3s ease;
}

.ob-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ob-actions .ob-right {
    display: flex;
    gap: 8px;
}

.ob-btn {
    border: none;
    border-radius: 9px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease;
}

.ob-btn-primary {
    background: linear-gradient(135deg, #f0c040, #c99700);
    color: #201800;
}

.ob-btn-primary:hover { filter: brightness(1.05); }

.ob-btn-ghost {
    background: transparent;
    color: #6b7482;
}

.ob-btn-ghost:hover { color: #101826; }

.ob-btn-secondary {
    background: #eef1f5;
    color: #3a4453;
}

.ob-btn-secondary:hover { background: #e3e8ef; }

/* Seta do balão apontando para o alvo */
.ob-balloon::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
}

.ob-balloon[data-arrow="top"]::after    { top: -7px;    left: 28px; }
.ob-balloon[data-arrow="bottom"]::after { bottom: -7px; left: 28px; }
.ob-balloon[data-arrow="none"]::after   { display: none; }

/* Modal de boas-vindas (fase obrigatória) */
.ob-welcome {
    position: fixed;
    inset: 0;
    z-index: 2000002;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 25, 0.82);
    padding: 20px;
}

.ob-welcome-card {
    background: #fff;
    color: #1c2431;
    border-radius: 18px;
    max-width: 420px;
    width: 100%;
    padding: 28px 26px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.ob-welcome-card .ob-emoji {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
}

.ob-welcome-card h2 {
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #101826;
}

.ob-welcome-card p {
    font-size: 14px;
    line-height: 1.55;
    color: #4a5566;
    margin-bottom: 20px;
}

.ob-welcome-card .ob-btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 15px;
}

/* Toast de bloqueio (ao tentar sair da aba Config antes de salvar o perfil) */
.ob-nudge {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    background: #201800;
    color: #ffd54f;
    border: 1px solid #c99700;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    z-index: 2000003;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    max-width: calc(100vw - 32px);
    text-align: center;
}

.ob-nudge.ob-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Estado visual da navegação travada durante a fase obrigatória */
.app-nav.ob-locked .nav-item {
    opacity: 0.45;
    filter: grayscale(0.4);
}

.app-nav.ob-locked .nav-item.active {
    opacity: 1;
    filter: none;
}

@media (max-width: 600px) {
    .ob-balloon {
        left: 16px !important;
        right: 16px !important;
        width: auto;
        bottom: 16px !important;
        top: auto !important;
    }
    .ob-balloon::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ob-spotlight, .ob-balloon, .ob-nudge, .ob-progress > i { transition: none; }
    .ob-spotlight.ob-pulse { animation: none; outline: 3px solid rgba(255, 193, 7, 0.9); outline-offset: 3px; }
}
