/**
 * DTF Help Modal - Simple Version
 * Modal minimalista con colores personalizables
 * Version: 4.3.1 (FIXED)
 * 
 * CHANGELOG:
 * - Arreglado media query huérfano (faltaba @media para móvil pequeño)
 */

/* Variables CSS personalizables */
:root {
    --dtf-modal-bg: #ffffff;
    --dtf-modal-text: #333333;
    --dtf-modal-button: #000000;
    --dtf-modal-step: #000000;
    --dtf-modal-radius: 8px;
    --dtf-modal-step-bg: rgba(0, 0, 0, 0.03);
}

/* ============================================
   BOTÓN DE AYUDA
   ============================================ */

/* Desktop: Header simple, botón va dentro pero se muestra debajo */
.dtf-step-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.dtf-step-title {
    width: 100%;
}

.dtf-help-btn-container {
    margin-bottom: 20px;
}

/* Desktop: Botón completo con texto */
.dtf-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--dtf-modal-button);
    border: 2px solid var(--dtf-modal-button);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dtf-help-btn:hover {
    background: #333333;
    border-color: #333333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dtf-help-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dtf-help-btn span {
    display: inline-block;
}

/* ============================================
   MODAL BASE
   ============================================ */

.dtf-help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dtf-help-modal.active {
    display: flex;
}

.dtf-help-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* ============================================
   CONTENEDOR DEL MODAL
   ============================================ */

.dtf-help-modal-content {
    position: relative;
    background: var(--dtf-modal-bg);
    color: var(--dtf-modal-text);
    border-radius: var(--dtf-modal-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* ============================================
   HEADER DEL MODAL
   ============================================ */

.dtf-help-modal-header {
    padding: 24px 24px 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dtf-help-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: inherit;
    margin: 0;
    text-align: center;
}

/* ============================================
   FOOTER DEL MODAL - BOTÓN ENTENDIDO
   ============================================ */

.dtf-help-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
}

.dtf-help-modal-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    background: var(--dtf-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 160px;
}

.dtf-help-modal-close-btn:hover {
    background: var(--dtf-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dtf-help-modal-close-btn:active {
    transform: translateY(0);
}

/* ============================================
   BODY - TODOS LOS PASOS VISIBLES
   ============================================ */

.dtf-help-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.dtf-help-steps-simple {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   CADA PASO
   ============================================ */

.dtf-help-step-simple {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 16px;
    align-items: start;
    padding: 16px;
    background: var(--dtf-modal-step-bg);
    border-radius: 6px;
    border-left: 3px solid var(--dtf-modal-step);
    opacity: 0.9;
}

/* Número del paso */
.dtf-help-step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dtf-modal-step);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.9;
}

/* Info del paso */
.dtf-help-step-info {
    flex: 1;
}

.dtf-help-step-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: inherit;
}

.dtf-help-step-info p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: inherit;
    opacity: 0.85;
}

/* Instrucciones para tontos - más grandes y claras */
.dtf-help-instruction {
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    opacity: 0.9 !important;
}

.dtf-help-instruction strong {
    font-weight: 700;
    opacity: 1;
}

/* Nota aclaratoria debajo de la instrucción */
.dtf-help-note {
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
    opacity: 0.85 !important;
    margin-top: 6px !important;
}

/* Destacar sin color agresivo - solo negrita y tamaño ligeramente mayor */
.dtf-help-note strong {
    font-weight: 600 !important;
    font-size: 14px !important;
    opacity: 1 !important;
}

/* GIF placeholder */
.dtf-help-gif-simple {
    width: 100px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    flex-shrink: 0;
}

.dtf-help-gif-placeholder {
    font-size: 12px;
    opacity: 0.5;
}

.dtf-help-gif-placeholder p {
    margin: 0;
}

/* SVG animado */
.dtf-help-svg {
    width: 100%;
    height: 100%;
    color: currentColor;
}

/* ============================================
   ANIMACIONES SVG
   ============================================ */

/* Paso 1: Archivo subiendo */
@keyframes fileUpload {
    0%, 100% { transform: translateY(0); opacity: 0.8; }
    50% { transform: translateY(-10px); opacity: 1; }
}

.svg-file-upload {
    animation: fileUpload 2s ease-in-out infinite;
}

@keyframes arrowBounce {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

.svg-arrow-up {
    animation: arrowBounce 2s ease-in-out infinite;
}

/* Paso 2: Marcador de metros moviéndose */
@keyframes markerMove {
    0% { cx: 30; }
    50% { cx: 60; }
    100% { cx: 30; }
}

.svg-marker {
    animation: markerMove 3s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.svg-text-meters {
    animation: textPulse 3s ease-in-out infinite;
}

/* Paso 3: Camión moviéndose */
@keyframes truckMove {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

.svg-truck {
    animation: truckMove 2s ease-in-out infinite;
}

@keyframes speedLines {
    0% { opacity: 0; transform: translateX(0); }
    50% { opacity: 0.5; transform: translateX(-5px); }
    100% { opacity: 0; transform: translateX(-10px); }
}

.svg-speed-lines line:nth-child(1) {
    animation: speedLines 1.5s ease-out infinite;
}

.svg-speed-lines line:nth-child(2) {
    animation: speedLines 1.5s ease-out 0.2s infinite;
}

.svg-speed-lines line:nth-child(3) {
    animation: speedLines 1.5s ease-out 0.4s infinite;
}

@keyframes clockRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.svg-clock-hand {
    transform-origin: 75px 35px;
    animation: clockRotate 2s linear infinite;
}

/* Paso 4: Producto cayendo y check */
@keyframes productDrop {
    0% { transform: translateY(-20px); opacity: 0; }
    50% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.8; }
}

.svg-product-drop {
    animation: productDrop 2.5s ease-in-out infinite;
}

@keyframes checkPop {
    0%, 80% { transform: scale(0.8); opacity: 0.5; }
    90% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.svg-check {
    animation: checkPop 2.5s ease-in-out infinite;
}

/* Cuando se añada el GIF real */
.dtf-help-gif-simple img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* ============================================
   RESPONSIVE - TABLET (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    .dtf-step-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dtf-help-btn {
        width: 100%;
        justify-content: center;
        order: -1;
        margin-bottom: 12px;
    }
    
    .dtf-help-modal {
        padding: 15px;
    }
    
    .dtf-help-modal-content {
        max-height: 90vh;
    }
    
    .dtf-help-modal-header {
        padding: 16px 20px;
    }
    
    .dtf-help-modal-body {
        padding: 20px;
    }
    
    .dtf-help-step-simple {
        grid-template-columns: 36px 1fr;
        gap: 12px;
    }
    
    .dtf-help-instruction {
        font-size: 14px !important;
    }
    
    .dtf-help-note {
        font-size: 12px !important;
        margin-top: 3px !important;
    }
    
    .dtf-help-gif-simple {
        grid-column: 1 / -1;
        width: 100%;
        height: 100px;
        margin-top: 12px;
    }
}

/* ============================================
   RESPONSIVE - MÓVIL PEQUEÑO (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    .dtf-help-modal {
        padding: 10px;
    }
    
    .dtf-help-modal-content {
        border-radius: 6px;
        max-height: 95vh;
    }
    
    .dtf-help-modal-header {
        padding: 14px 16px;
    }
    
    .dtf-help-modal-header h3 {
        font-size: 16px;
    }
    
    .dtf-help-modal-body {
        padding: 16px;
    }
    
    .dtf-help-steps-simple {
        gap: 16px;
    }
    
    .dtf-help-step-simple {
        padding: 12px;
        grid-template-columns: 32px 1fr;
        gap: 10px;
    }
    
    .dtf-help-step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .dtf-help-instruction {
        font-size: 13px !important;
    }
    
    .dtf-help-note {
        font-size: 11px !important;
        margin-top: 2px !important;
    }
    
    .dtf-help-gif-simple {
        height: 90px;
        margin-top: 10px;
    }
}

/* ============================================
   ACCESIBILIDAD Y PREFERENCIAS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .dtf-help-btn,
    .dtf-help-modal-close-btn {
        transition: none;
    }
}

/* Mejora para modo oscuro si el tema lo soporta */
@media (prefers-color-scheme: dark) {
    .dtf-help-modal-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .dtf-help-step-simple {
        background: rgba(255, 255, 255, 0.05);
    }
}
