/* STEPS / ACORDEONES INTERACTIVOS 
 * Versión mejorada con animaciones suaves
 */

.step-card {
    border: 2px solid transparent;
    transition: all var(--transition-speed);
    margin-bottom: 16px;
    position: relative;
}

/* Paso completado */
.step-card.completed {
    border-color: var(--success);
    background-color: var(--success-light);
}

/* Paso bloqueado: solo indicador visual */
.step-card.blocked {
    opacity: 0.65;
    filter: grayscale(0.3);
}

/* Header del paso */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-speed);
    padding: 4px 0;
}

.step-header:hover {
    background-color: rgba(37, 99, 235, 0.03);
}

.step-header:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Título y tilde */
.step-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-check {
    margin-left: 12px;
    font-size: 20px;
    color: var(--success);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.8);
}

/* Mostrar tilde cuando el paso está completado */
.step-card.completed .step-check {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Cuerpo del paso: acordeón con animación suave */
.step-body {
    margin-top: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease;
    opacity: 0;
}

.step-body.open {
    max-height: 5000px; /* Valor suficientemente grande */
    opacity: 1;
}

/* Ayuda del paso */
.step-help {
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botonera */
.button-row {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Botones genéricos */
.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed), 
                transform var(--transition-speed), 
                box-shadow var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.btn:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.12);
}

.btn:active:not([disabled]) {
    transform: translateY(0);
}

.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Efecto ripple sutil */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active:not([disabled])::after {
    width: 300px;
    height: 300px;
}

/* Variantes de botones */
.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover:not([disabled]) {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not([disabled]) {
    background-color: #dbeafe;
}

.btn-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover:not([disabled]) {
    background-color: #fee2e2;
}

/* Estado deshabilitado de botones */
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn[disabled]:hover {
    box-shadow: none;
}

/* Tarjeta de finalización */
.completion-card {
    display: none;
    border-left: 4px solid var(--success);
    margin-top: 24px;
    animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Barra de progreso */
.progress-container {
    margin-bottom: 24px;
    background-color: #fff;
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    border: 1px solid var(--border-subtle);
}

.progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-bar {
    height: 8px;
    background-color: var(--bg);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    padding: 0 8px;
    min-width: 80px;
}

/* Responsive: ajustes para móviles */
@media (max-width: 640px) {
    .step-header h3 {
        font-size: 16px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .progress-fill {
        font-size: 9px;
        min-width: 70px;
    }
}

/* Modo impresión */
@media print {
    .step-body {
        max-height: none !important;
        opacity: 1 !important;
        display: block !important;
    }
    
    .button-row,
    .progress-container {
        display: none;
    }
    
    .step-card {
        page-break-inside: avoid;
    }
}
/* === TROUBLESHOOTING (Ayuda contextual) === */
.troubleshooting {
    margin-top: 24px;
    border-top: 2px solid #e5e7eb;
    padding-top: 16px;
}

.troubleshooting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.troubleshooting-header:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

.troubleshooting-header strong {
    color: #92400e;
    font-size: 15px;
}

.troubleshooting-header span {
    color: #92400e;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.troubleshooting-body {
    display: none;
    padding: 20px;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
}

.troubleshooting-body.open {
    display: block;
}

.troubleshooting-body h4 {
    margin-top: 0;
    color: #92400e;
    font-size: 16px;
}

.troubleshooting-body ul {
    margin: 12px 0;
}

.troubleshooting-body li {
    margin-bottom: 12px;
    color: #78350f;
}

.troubleshooting-body a {
    color: #2563eb;
    text-decoration: underline;
}
/* === SUB-CHECKBOXES (Checkboxes dentro de pasos procedimentales) === */
.substep-list {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.substep-list li {
    margin-bottom: 8px;
}

.substep-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.substep-checkbox:hover {
    background-color: #f9fafb;
}

.substep-checkbox input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.substep-checkbox span {
    flex: 1;
    line-height: 1.5;
    color: #374151;
}

/* Tachar texto cuando está marcado */
.substep-checkbox input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: #9ca3af;
}

/* Opcional: Cambiar color del checkbox marcado */
.substep-checkbox input[type="checkbox"]:checked {
    accent-color: #10b981;
}

/* === TROUBLESHOOTING (Ayuda contextual) === */
.troubleshooting {
    margin-top: 24px;
    border-top: 2px solid #e5e7eb;
    padding-top: 16px;
}

.troubleshooting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.troubleshooting-header:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

.troubleshooting-header strong {
    color: #92400e;
    font-size: 15px;
}

.troubleshooting-header span {
    color: #92400e;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.troubleshooting-body {
    display: none;
    padding: 20px;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
}

.troubleshooting-body.open {
    display: block;
}

.troubleshooting-body h4 {
    margin-top: 0;
    color: #92400e;
    font-size: 16px;
}

.troubleshooting-body ul {
    margin: 12px 0;
}

.troubleshooting-body li {
    margin-bottom: 12px;
    color: #78350f;
}

.troubleshooting-body a {
    color: #2563eb;
    text-decoration: underline;
}
