/* --- Estilos generales y de escritorio --- */
.cot-state-desc-wider {
    margin: 20px auto 30px auto;
    background: #f6f2ff;
    color: #3c2078;
    font-size: 1.18em;
    padding: 24px 36px;
    border-radius: 12px;
    max-width: 900px;
    min-width: 320px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(114, 31, 212, 0.08);
    /* Sombra suavizada */
    font-weight: 500;
    line-height: 1.5;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cot-state-desc-wider:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(114, 31, 212, 0.12);
}

.cot-tracking-progress-bar {
    display: flex;
    display: flex;
    align-items: flex-start;
    /* Fix for variable height steps */
    justify-content: space-between;
    margin: 40px auto 36px;
    max-width: 900px;
    width: 100%;
}

.cot-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 120px;
    position: relative;
    box-sizing: border-box;
    /* Ensure no margins interfere with connectivity */
    margin: 0;
}

/* DESKTOP CONNECTING LINE (Pseudo-element) */
.cot-progress-step::after {
    content: '';
    position: absolute;
    top: 13px;
    /* Center of 22px circle (11px) plus border/offset */
    left: 50%;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    z-index: 0;
    transition: background 0.4s ease;
}

/* Line Color Logic */
.cot-progress-step.completed::after {
    background: #39d353;
}

/* Hide line for last step */
.cot-progress-step:last-child::after {
    display: none;
}

.cot-progress-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 3px solid #dedede;
    margin-bottom: 5px;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cot-progress-step.active .cot-progress-circle {
    background: #721fd4;
    border-color: #721fd4;
    transform: scale(1.1);
}

.cot-progress-step.completed .cot-progress-circle {
    background: #39d353;
    border-color: #39d353;
}

.cot-step-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.cot-progress-label {
    margin-top: 0;
    font-size: 1.04em;
    color: #aaa;
    text-align: center;
    font-weight: 500;
    line-height: 1.4;
    word-break: keep-all;
    max-width: 180px;
    transition: color 0.3s ease;
}

.cot-progress-step.active .cot-progress-label {
    color: #721fd4;
    font-weight: 700;
}

.cot-progress-step.completed .cot-progress-label {
    color: #39d353;
    font-weight: 700;
}

.cot-progress-date {
    margin-top: 7px;
    font-size: 0.97em;
    color: #444;
    background: #f3f0fa;
    padding: 2px 8px;
    border-radius: 7px;
    min-width: 90px;
    display: inline-block;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

.cot-progress-date-delayed {
    background: #fdeeee;
    font-weight: 700;
}

.cot-progress-date[aria-retraso="true"] {
    color: #b88;
    background: #fdeeee;
    font-weight: 700;
}

.cot-alert-tooltip {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    cursor: pointer;
    outline: none;
    margin-top: 3px;
}

.cot-alert-tooltip-desktop {
    /* Visible por defecto en desktop gracias a .cot-alert-tooltip */
}

.cot-progress-warning-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    margin-top: 2px;
    width: 100%;
    height: 1.3em;
    pointer-events: none;
    user-select: none;
}

.cot-tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 230px;
    background: #fdeeee;
    color: #d00;
    text-align: left;
    border-radius: 8px;
    padding: 9px 15px;
    position: absolute;
    z-index: 100;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    box-shadow: 0 4px 20px rgba(248, 202, 202, 0.2);
    font-size: 1em;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    line-height: 1.5;
    font-weight: 400;
}

.cot-alert-tooltip:hover .cot-tooltip-text,
.cot-alert-tooltip:focus-within .cot-tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Old Line Element - Hidden Globally in favor of pseudo-elements */
.cot-progress-bar-line {
    display: none !important;
}

.cot-tracking-details {
    max-width: 520px;
    margin: 0 auto 40px;
    background: #fafafa;
    border-radius: 12px;
    /* Más redondeado */
    padding: 24px 32px 16px;
    box-shadow: 0 4px 15px rgba(60, 0, 150, 0.05);
    /* Sombra más suave */
    font-size: 1.13em;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.cot-tracking-details ul {
    margin: 0 0 0 16px;
}

.cot-tracking-details img {
    box-shadow: 0 2px 8px rgba(60, 0, 150, 0.05);
    border-radius: 4px;
}

/* Formulario */
.cot-track-form-container {
    max-width: 420px;
    margin: 40px auto 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 32px 32px 20px;
    transition: transform 0.3s ease;
}

.cot-track-form-container:hover {
    transform: translateY(-2px);
}

.cot-input-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

.cot-input-field {
    width: 100%;
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid #dadada;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-size: 1rem;
}

.cot-input-field:focus {
    border-color: #721fd4;
    box-shadow: 0 0 0 3px rgba(114, 31, 212, 0.1);
    outline: none;
}

.cot-submit-btn {
    background: #721fd4;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    display: block;
    width: 100%;
}

.cot-submit-btn:hover {
    background: #5e1ab0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(114, 31, 212, 0.25);
}

.cot-submit-btn:active {
    transform: translateY(0);
}

/* Botón de seguimiento externo */
.cot-external-tracking-btn {
    display: inline-block;
    background: #1470b6;
    color: #fff;
    font-weight: 600;
    padding: 13px 32px;
    font-size: 1.09em;
    text-decoration: none;
    border-radius: 24px;
    margin-top: 8px;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.cot-external-tracking-btn:hover {
    background: #0f5a94;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 112, 182, 0.25);
    color: #fff;
}

/* ----------- RESPONSIVE MOBILE FIX ----------- */
@media (max-width: 800px) {
    .cot-tracking-progress-bar {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        max-width: 98vw;
        width: 100%;
        margin: 30px auto 24px;
    }

    .cot-progress-step {
        min-width: unset;
        flex: none;
        flex-direction: row;
        align-items: stretch;
        /* Stretch to allow line to full height */
        margin: 0;
        padding: 0 0 32px 0px;
        /* Space for line continuity */
        position: relative;
    }

    .cot-progress-circle {
        margin-bottom: 0;
        margin-right: 16px;
        margin-top: 2px;
        margin-left: 20px;
        /* Indent circle */
        flex-shrink: 0;
        z-index: 1;
        position: relative;
        background: #fff;
        /* Ensure transparency doesn't show line behind */
    }

    /* Ensure completed/active circles match design */
    .cot-progress-step.completed .cot-progress-circle {
        background: #39d353;
    }

    .cot-progress-step.active .cot-progress-circle {
        background: #721fd4;
    }

    .cot-step-info {
        align-items: flex-start;
        /* Left align text on mobile */
        width: auto;
        flex: 1;
        /* Take remaining space */
    }

    .cot-progress-label,
    .cot-progress-date {
        margin-top: 0;
        text-align: left;
    }

    .cot-progress-label {
        max-width: none;
        margin-bottom: 4px;
        line-height: 1.3;
        font-size: 1em;
        color: #333;
        /* Darker for better contrast */
    }

    .cot-progress-step.active .cot-progress-label,
    .cot-progress-step.completed .cot-progress-label {
        font-size: 1.05em;
    }

    /* Refining Date Look for Mobile */
    .cot-progress-date {
        font-size: 0.9em;
        background: transparent;
        padding: 0;
        color: #666;
        font-weight: 400;
    }

    /* Keep delayed styling though */
    .cot-progress-date-delayed {
        background: #fdeeee;
        padding: 2px 8px;
        color: #d00 !important;
    }

    /* HIDE the old separate div line */
    .cot-progress-bar-line {
        display: none !important;
    }

    /* THE LINE (Pseudo-element) - Vertical Override */
    .cot-progress-step::after {
        content: '';
        position: absolute;
        /* Reset Desktop values */
        left: 31px;
        /* 20px padding-left + 11px radius */
        right: auto;
        top: 26px;
        width: 3px !important;
        height: calc(100% - 22px) !important;
        background: #e0e0e0;
        z-index: 0;
    }

    /* Line Color Logic */
    .cot-progress-step.completed::after {
        background: #39d353;
    }

    /* Hide line for last step */
    .cot-progress-step:last-child::after {
        display: none;
    }

    .cot-alert-delay-mobile {
        margin: 20px 10px;
        text-align: center;
        animation: fadeIn 0.5s ease;
    }

    /* HIDE Tooltip on mobile to avoid duplication */
    .cot-alert-tooltip .cot-tooltip-text {
        display: none !important;
    }

    /* Disable pointer events on warning emoji in mobile to prevent confusion */
    .cot-progress-warning-emoji {
        pointer-events: none;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}