/* ============================================================
   CSS del Módulo de Acompañamiento a la Inserción - ANDEIS
   Extiende el sistema de diseño de custom.css
   ============================================================ */

/* -- Scoping: min-height auto para cards compactas ---------- */
.insercion-dashboard .card,
.insercion-detail .card,
.insercion-ficha .card {
    min-height: auto;
}

/* -- Timeline de fases -------------------------------------- */
.fase-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 1.5rem 0;
    overflow-x: auto;
}

.fase-timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 100px;
    position: relative;
}

.fase-timeline-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
    border: 2px solid transparent;
}

.fase-timeline-circle.completed {
    background: #86bb11;
    color: #fff;
    box-shadow: 0 0 15px rgba(134, 187, 17, 0.3);
}

.fase-timeline-circle.current {
    background: #015f2d;
    color: #fff;
    box-shadow: 0 0 20px rgba(1, 95, 45, 0.4);
    animation: pulse 2s infinite;
}

.fase-timeline-circle.pending {
    background: rgba(0, 0, 0, 0.06);
    color: #64748b;
    border-color: rgba(0, 0, 0, 0.1);
}

.fase-timeline-circle:hover {
    transform: scale(1.15);
}

.fase-timeline-connector {
    flex: 1;
    height: 3px;
    min-width: 20px;
    align-self: center;
    margin-top: -1rem;
    border-radius: 2px;
}

.fase-timeline-connector.completed {
    background: linear-gradient(90deg, #86bb11, #86bb11);
}

.fase-timeline-connector.active {
    background: linear-gradient(90deg, #86bb11, #015f2d);
}

.fase-timeline-connector.pending {
    background: rgba(0, 0, 0, 0.08);
}

.fase-timeline-label {
    font-size: 0.72rem;
    text-align: center;
    margin-top: 0.5rem;
    max-width: 100px;
    color: #64748b;
    line-height: 1.3;
}

.fase-timeline-label.current {
    color: #015f2d;
    font-weight: 700;
}

.fase-timeline-label.completed {
    color: #86bb11;
    font-weight: 600;
}

/* -- Anillo de progreso circular ---------------------------- */
.progress-ring {
    width: 120px;
    height: 120px;
    margin: 0 auto 0.75rem;
}

.progress-ring circle {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-ring-bg {
    stroke: rgba(0, 0, 0, 0.06);
}

.progress-ring-fill {
    stroke: #86bb11;
    filter: drop-shadow(0 0 6px rgba(134, 187, 17, 0.4));
}

.progress-ring-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    fill: #015f2d;
}

.progress-ring-subtext {
    font-family: 'Outfit', sans-serif;
    font-size: 0.55rem;
    fill: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* -- Radio buttons de competencias -------------------------- */
.competencia-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.competencia-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #64748b;
    background: rgba(255, 255, 255, 0.5);
}

.competencia-label:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.03);
}

.competencia-radio:checked + .competencia-label {
    transform: scale(1.1);
}

.competencia-radio[value="0"]:checked + .competencia-label {
    border-color: #64748b;
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.competencia-radio[value="1"]:checked + .competencia-label {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.competencia-radio[value="2"]:checked + .competencia-label {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.competencia-radio[value="3"]:checked + .competencia-label {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.competencia-radio[value="4"]:checked + .competencia-label {
    border-color: #86bb11;
    background: rgba(134, 187, 17, 0.1);
    color: #86bb11;
    box-shadow: 0 0 10px rgba(134, 187, 17, 0.15);
}

.competencia-radio:focus-visible + .competencia-label {
    outline: 3px solid #06b6d4;
    outline-offset: 2px;
}

/* -- Status badges con variantes de color ------------------- */
.status-badge-success {
    background: rgba(134, 187, 17, 0.15) !important;
    color: #86bb11 !important;
    border-color: rgba(134, 187, 17, 0.3) !important;
}

.status-badge-primary {
    background: rgba(1, 95, 45, 0.15) !important;
    color: #015f2d !important;
    border-color: rgba(1, 95, 45, 0.3) !important;
}

.status-badge-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.status-badge-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

.status-badge-info {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #06b6d4 !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
}

.status-badge-secondary {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #64748b !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* -- HTMX loading states ------------------------------------ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.htmx-spinner {
    display: none;
    animation: spin 1s linear infinite;
}

.htmx-request .htmx-spinner {
    display: inline-block;
}

.htmx-request .htmx-hide-on-request {
    display: none;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line {
    height: 1rem;
    background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.02) 50%, rgba(0,0,0,0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* -- Animación de ficha recién completada ------------------- */
@keyframes successGlow {
    0%, 100% { box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.08); }
    50% { box-shadow: 0 0 25px 5px rgba(134, 187, 17, 0.2); }
}

.ficha-just-completed {
    animation: successGlow 1.5s ease 2;
}

/* -- Range sliders con color dinámico ----------------------- */
.range-competencia {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
    outline: none;
    transition: all 0.3s;
}

.range-competencia::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #015f2d;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(1, 95, 45, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #fff;
}

.range-competencia::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(1, 95, 45, 0.4);
}

.range-competencia::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #015f2d;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(1, 95, 45, 0.3);
    border: 2px solid #fff;
}

/* -- Responsive: card-view para tablas en móvil ------------- */
@media (max-width: 768px) {
    .table-glass-responsive thead {
        display: none;
    }

    .table-glass-responsive tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        padding: 1rem;
        box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.06);
    }

    .table-glass-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
        border-top: none;
        border-left: none;
        border-right: none;
    }

    .table-glass-responsive tbody td:last-child {
        border-bottom: none;
    }

    .table-glass-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #64748b;
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .fase-timeline {
        gap: 0.25rem;
        padding: 1rem 0;
    }

    .fase-timeline-step {
        min-width: 60px;
    }

    .fase-timeline-circle {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.75rem;
    }

    .fase-timeline-label {
        font-size: 0.6rem;
        max-width: 65px;
    }
}

/* -- Accesibilidad: focus visible --------------------------- */
.btn-glass-primary:focus-visible,
.btn-glass-outline-secondary:focus-visible,
.btn-glass-outline-primary:focus-visible,
.btn-table-action:focus-visible {
    outline: 3px solid #06b6d4;
    outline-offset: 2px;
}

/* -- Sección de acordeón expandida -------------------------- */
.accordion-section-header {
    transition: background 0.3s ease;
}

.accordion-section-header:hover {
    background: rgba(1, 95, 45, 0.02);
}

.section-check-icon {
    color: #86bb11;
    font-size: 1rem;
}
