/* --- Estilos Generales y Escritorio --- */
.tracking-timeline-container {
    width: 100%;
    padding: 30px 0;
}

.tracking-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 0 auto;
    max-width: 800px;
}

.tracking-steps::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 8%;
    right: 8%;
    height: 4px;
    background-color: #e9ecef;
    z-index: 1;
}

.step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.step.completed .step-icon {
    background-color: #0d6efd !important;
    color: #fff !important;
}

.step-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 3px;
}

.step-date {
    display: block;
    font-size: 12px;
    color: #6c757d;
}

/* Escritorio: Textos intercalados Arriba / Abajo */
@media (min-width: 769px) {
    .step:nth-child(odd) .step-content {
        position: absolute;
        top: 60px;
        width: 160px;
        left: 50%;
        transform: translateX(-50%);
    }

    .step:nth-child(even) {
        flex-direction: column-reverse;
    }

    .step:nth-child(even) .step-content {
        position: absolute;
        bottom: 60px;
        width: 160px;
        left: 50%;
        transform: translateX(-50%);
    }

    .border-end-md {
        border-right: 1px solid #dee2e6 !important;
    }
}

/* --- ESTILOS DEL CHAT DE SOPORTE --- */
.desktop-chat-thread {
    background: #fdfdfe;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 15px;
    max-height: 260px;
    overflow-y: auto;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.client-bubble {
    background: #f1f3f5;
    border-left: 4px solid #0d6efd;
    margin-right: 15px;
}

.support-bubble {
    background: #e2f0d9;
    border-left: 4px solid #198754;
    margin-left: 15px;
}

/* --- Estado Activo con Pulso Elegante --- */
@keyframes pulseSuave {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

.step.active .step-icon {
    background-color: #0d6efd !important;
    color: #fff !important;
    animation: pulseSuave 2s infinite ease-in-out;
}

/* --- Animación de Giro para el botón Actualizar --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spin-animation {
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   ESTILOS RESPONSIVOS PARA MÓVILES (Zig-Zag Corregido y Fix de Botón)
   ========================================================================== */
@media (max-width: 768px) {
    
    .card {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Botón actualizar adaptativo en su propia fila o ajustado sin desbordar */
    .card .d-flex.flex-column.flex-md-row {
        align-items: stretch !important;
    }

    .card .d-flex.flex-column.flex-md-row .btn {
        width: 100% !important;
        justify-content: center !important;
        margin-top: 5px !important;
    }

    .card span.font-monospace {
        font-size: 11px !important;
        word-break: break-all;
    }

    /* Línea de tiempo vertical centrada en móviles con ancho correcto */
    .tracking-timeline-container {
        padding: 20px 0 !important;
        overflow: hidden;
    }

    .tracking-steps {
        flex-direction: column !important;
        align-items: center !important;
        position: relative !important;
        margin: 0 auto !important;
        width: 100% !important;
    }

    /* Línea vertical en el centro exacto */
    .tracking-steps::before {
        content: '';
        position: absolute;
        top: 20px;
        bottom: 20px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        width: 3px !important;
        height: auto !important;
        background-color: #e9ecef;
        z-index: 1;
    }

    .step {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-height: 65px;
        margin-bottom: 25px !important;
        position: relative !important;
    }

    .step:last-child {
        margin-bottom: 0 !important;
    }

    /* Iconos centrados sobre la línea */
    .step-icon {
        width: 42px !important;
        height: 42px !important;
        margin: 0 !important;
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 2;
        flex-shrink: 0;
    }

    /* Ancho correcto (42%) para que el texto respire y alterne bien */
    .step-content {
        position: absolute !important;
        width: 42% !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* PASOS IMPARES (1 y 3): Texto a la DERECHA */
    .step:nth-child(odd) .step-content {
        left: calc(50% + 28px) !important;
        right: auto !important;
        text-align: left !important;
    }

    /* PASOS PARES (2 y 4): Texto a la IZQUIERDA */
    .step:nth-child(even) .step-content {
        right: calc(50% + 28px) !important;
        left: auto !important;
        text-align: right !important;
    }

    .step-title {
        font-size: 12px !important;
        font-weight: 700;
        color: #333;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    .step-date {
        font-size: 10px !important;
        color: #6c757d;
    }

    .desktop-chat-thread {
        max-height: 200px;
    }
}