/**
 * CaseHub Lite - Onboarding Tour Styles
 * Custom Shepherd.js theme matching CaseHub aesthetic
 */

/* Modal overlay */
.shepherd-modal-overlay-container {
    fill: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

/* AND-06: o Shepherd desenha o overlay como um <path> de SVG e marca esse
   path com pointer-events:all — é o mecanismo que bloqueia clique fora do
   recorte do passo atual. No passo 1 (welcome) não há attachTo, então o
   path cobre a tela inteira sem nenhum recorte: qualquer toque fora do
   card do tour, incluindo a bolha "Mais" do dock mobile, é engolido em
   silêncio (sem erro, sem toast) — confirmado ao vivo com
   document.elementFromPoint() na posição real do botão, que devolvia o
   <path> do overlay em vez do botão. Passos com attachTo pra um único
   item do dock (controladoria/agenda/tarefas/clientes/processos) têm o
   mesmo problema pro resto do dock, incluindo "Mais" de novo, porque o
   recorte do Shepherd só expõe UM elemento por vez.
   Navegação global não pode ficar refém de qual passo do tour está
   ativo. Mantém o escurecimento visual (fill) intacto — só desliga a
   captura de clique do path, que é o único elemento com pointer-events
   diferente de none no container. */
.shepherd-modal-overlay-container path {
    pointer-events: none !important;
}

/* Tour step bubble */
.ch-tour-load-error {
    position: fixed;
    right: var(--space-4);
    bottom: calc(var(--bottomnav-h, 0px) + var(--space-4));
    z-index: var(--z-toast);
    max-width: min(32rem, calc(100vw - (var(--space-4) * 2)));
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--c-danger);
    box-shadow: var(--shadow-dark-sm), var(--shadow-light-sm);
}

.shepherd-element.casehub-tour-step {
    border-radius: 16px !important;
    font-family: var(--display);
    box-shadow:
        0 8px 32px rgba(14, 165, 233, 0.12),
        0 2px 16px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.2);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    overflow: hidden;
    max-width: 400px;
}

/* Dark mode support */
[data-theme="dark"] .shepherd-element.casehub-tour-step {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow:
        0 8px 32px rgba(14, 165, 233, 0.15),
        0 2px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Header / title */
.casehub-tour-step .shepherd-header {
    background: transparent;
    padding: 20px 24px 0;
}

.casehub-tour-step .shepherd-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.1rem;
    color: #0f172a;
    letter-spacing: -0.01em;
}

[data-theme="dark"] .casehub-tour-step .shepherd-title {
    color: #f1f5f9;
}

/* Cancel (X) button */
.casehub-tour-step .shepherd-cancel-icon {
    color: #94a3b8;
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.casehub-tour-step .shepherd-cancel-icon:hover {
    color: #1C2447;
    opacity: 1;
}

/* Body text */
.casehub-tour-step .shepherd-text {
    padding: 12px 24px 8px;
    font-family: var(--display);
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
}

[data-theme="dark"] .casehub-tour-step .shepherd-text {
    color: #cbd5e1;
}

/* Footer / buttons */
.casehub-tour-step .shepherd-footer {
    padding: 12px 24px 20px;
    border-top: none;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    position: relative;
}

/* Progress dots */
.casehub-tour-step .shepherd-footer::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: 6px;
    display: flex;
    gap: 5px;
}

/* Primary button (cyan) */
.casehub-tour-step .shepherd-button-primary {
    background: #1C2447;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 20px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.casehub-tour-step .shepherd-button-primary:hover {
    background: #1a6670;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.casehub-tour-step .shepherd-button-primary:active {
    transform: translateY(0);
}

/* Secondary button (gray) */
.casehub-tour-step .shepherd-button-secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 20px;
    font-family: var(--display);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.casehub-tour-step .shepherd-button-secondary:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

[data-theme="dark"] .casehub-tour-step .shepherd-button-secondary {
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .casehub-tour-step .shepherd-button-secondary:hover {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

/* Arrow */
.casehub-tour-step .shepherd-arrow,
.casehub-tour-step .shepherd-arrow::before {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .casehub-tour-step .shepherd-arrow,
[data-theme="dark"] .casehub-tour-step .shepherd-arrow::before {
    background: rgba(30, 41, 59, 0.95);
}

/* Progress dots container - appended via JS */
.casehub-tour-progress {
    display: flex;
    gap: 5px;
    justify-content: center;
    padding: 0 24px 16px;
}

.casehub-tour-progress .tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.3s, transform 0.3s;
}

.casehub-tour-progress .tour-dot.active {
    background: #1C2447;
    transform: scale(1.3);
}

.casehub-tour-progress .tour-dot.completed {
    background: #38bdf8;
}

[data-theme="dark"] .casehub-tour-progress .tour-dot {
    background: #334155;
}

[data-theme="dark"] .casehub-tour-progress .tour-dot.active {
    background: #1C2447;
}

[data-theme="dark"] .casehub-tour-progress .tour-dot.completed {
    background: #1a6670;
}

/* Entrance animation */
.shepherd-element.casehub-tour-step {
    animation: tourFadeIn 0.3s ease-out;
}

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

/* Sidebar highlight effect */
.shepherd-target {
    transition: box-shadow 0.3s;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3) !important;
    border-radius: 8px;
}

/* "Ver Tutorial" button styling in sidebar */
.nav-link[onclick*="startOnboardingTour"] {
    opacity: 0.7;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.nav-link[onclick*="startOnboardingTour"]:hover {
    opacity: 1;
    color: #1C2447 !important;
}

/* Progress bar (inline in step text) */
.casehub-tour-progress-bar {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

[data-theme="dark"] .casehub-tour-progress-bar {
    border-bottom-color: rgba(255,255,255,0.08);
}

.tour-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: #1C2447;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.tour-progress-track {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="dark"] .tour-progress-track {
    background: #334155;
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1C2447, #38bdf8);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* CTA styling in tour steps */
.tour-cta {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #334155;
}

[data-theme="dark"] .tour-cta {
    color: #94a3b8;
}
