/* =============================================================================
   Onboarding Checklist Widget — NormaCode v1.0
   Floating bottom-right progress checklist
   ============================================================================= */

.oc-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9000;
    width: 280px;
    background: #0f172a;
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.3s, transform 0.3s;
}

.oc-widget.oc-fade-out {
    opacity: 0;
    transform: translateY(20px);
}

/* Header (clickable to collapse/expand) */
.oc-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    gap: 8px;
}

.oc-header:hover {
    background: rgba(255, 255, 255, 0.06);
}

.oc-title {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
}

.oc-pct {
    font-size: 0.75rem;
    font-weight: 700;
    color: #34d399;
    font-family: 'JetBrains Mono', monospace;
}

.oc-toggle {
    font-size: 0.6rem;
    color: #6b7280;
    margin-left: 4px;
}

/* Dismiss × — target ≥24×24px (WCAG 2.2 SC 2.5.8 AA) */
.oc-dismiss {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    min-width: 24px;
    min-height: 24px;
    margin-left: 2px;
    border-radius: 6px;
}
.oc-dismiss:hover {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.08);
}

/* Progress bar */
.oc-progress-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.oc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #34d399);
    transition: width 0.5s ease;
    border-radius: 0 2px 2px 0;
}

/* Body (items) */
.oc-body {
    padding: 10px 16px 14px;
}

/* Individual item */
.oc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.82rem;
    color: #9ca3af;
    transition: color 0.2s;
}

.oc-item.oc-done {
    color: #34d399;
}

.oc-item.oc-done .oc-label {
    text-decoration: line-through;
    text-decoration-color: rgba(52, 211, 153, 0.3);
}

.oc-check {
    font-size: 0.9rem;
    flex-shrink: 0;
    line-height: 1;
}

.oc-label {
    flex: 1;
}

/* Next action */
.oc-next {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.oc-next-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #38bdf8;
    text-decoration: none;
    transition: color 0.2s;
}

.oc-next-link:hover {
    color: #34d399;
}

/* Celebration state */
.oc-widget.oc-celebrate {
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

/* Compensación de espacio (audit pase 59 M3): mientras el widget fijo está
   visible, el scroller principal reserva espacio al final para que CTAs de
   avance, últimas filas de tablas e inputs puedan scrollearse POR SOBRE el
   widget (WCAG 2.2 SC 2.4.11 Focus Not Obscured — un control con foco no
   puede quedar enteramente tapado por contenido del autor). */
body.has-oc-widget .main-content,
body.has-oc-widget .scroll-container {
    padding-bottom: 96px;
}

/* Responsive móvil: tarjeta compacta anclada a la derecha (NO franja
   full-width: cubría el ancho completo del viewport, audit pase 59) */
@media (max-width: 480px) {
    .oc-widget {
        /* Audit §23 R4 (2026-07-09): bottom:12px quedaba SOBRE la bottom-nav
           móvil (~64px) tapándola — se ancla por encima de la barra. */
        bottom: 84px;
        right: 12px;
        left: auto;
        width: min(280px, calc(100vw - 24px));
    }
}

/* Don't overlap with sidebar on desktop */
@media (min-width: 769px) {
    .oc-widget {
        right: 24px;
        bottom: 24px;
    }
}

/* F2 móvil v3 §24 2026-07-10 — Nav pura: en MÓVIL el widget de progreso solo
   vive en el dashboard. La clase la togglea onboarding-checklist.js
   (syncMobileVisibility) según hash + matchMedia. Scoped ≤768: en desktop la
   clase existe pero esta regla no aplica → desktop SIN CAMBIO. */
@media (max-width: 768px) {
  .oc-widget.oc-hidden-mobile {
    display: none !important;
  }
}
