/* =================================================
   HISTORY TIMELINE - ABOUT US (FINAL)
   ================================================= */

.history-container {
    display: flex;
    align-items: stretch;
    gap: var(--margin-section);
    margin: 0;
    padding: 0;
}

/* ---------- NAVEGACIÓN IZQUIERDA ---------- */

.history-nav {
    width: 30%;
    position: relative;
}

ul.history-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    padding-left: var(--padding-int); 
}

/* Línea vertical centralizada */
.history-nav__list::before {
    content: "";
    position: absolute;
    /* Ajustado para ser el eje central exacto de círculos y cápsula */
    left: 0; 
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--primary);
    z-index: 1;
}

.history-nav__item {
    position: relative;
    padding: var(--padding-btn);
    margin-bottom: var(--padding-int);
    cursor: pointer;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column; /* Dos líneas: Año/Dinero arriba, Título abajo */
    justify-content: center;
    min-height: 65px;
}

/* CÍRCULO INACTIVO (Outline que debe ser atravesado por la línea) */
.history-nav__item::after {
    content: "";
    position: absolute;
    /* Centrado exacto: 17px(eje) - 8px(mitad del ancho) = 9px */
    left: calc((-1 * var(--padding-int)) - (19px / 2)); 
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    background-color: var(--blanco); 
    border: 1px solid var(--primary);
    border-radius: 50%;
    z-index: 2;
    transition: opacity 0.3s ease;
}

/* ESTADO ACTIVO: Cápsula Azul que tapa la línea */
.history-nav__item.is-active {
    background-color: var(--primary);
    border-radius: 10px;
    color: var(--blanco) !important;
    padding:var(--padding-btn);
    z-index: 3;
}

/* Ocultamos el círculo outline cuando el item es la cápsula azul */
.history-nav__item.is-active::after {
    background-image: url('../images/reloj.svg');
    background-size: contain;
    background-repeat: no-repeat;
    width: 22px;
    height: 22px;
    background-color: transparent;
    border: none;
}

/* ICONO RELOJ (Solo en activo) - Usando el SVG de tu carpeta */
.history-nav__item.is-active::before {
    content: "";
    position: absolute;
    /* Posicionado dentro de la cápsula azul, alineado con el texto */
    left: calc(-1 * var(--padding-int) - (22px));
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary);
    width: 100%;
    height: 100%;
    border-radius: 10px;
    z-index: -1;
}

.history-nav__item:last-child:not(.is-active)::before {
    content: "";
    position: absolute;
    /* Posicionado dentro de la cápsula azul, alineado con el texto */
    left: calc(-1 * var(--padding-int) - (22px));
    bottom: 0;
    background-color: var(--blanco);
    width: 50%;
    height: 50%;
    z-index: 1;
}

.history-nav__item:first-child:not(.is-active)::before {
    content: "";
    position: absolute;
    /* Posicionado dentro de la cápsula azul, alineado con el texto */
    left: calc(-1 * var(--padding-int) - (22px));
    top: 0;
    background-color: var(--blanco);
    width: 50%;
    height: 50%;
    z-index: 1;
}

/* ---------- TEXTOS (DOS LÍNEAS) ---------- */

.nav-title {
    color: var(--text-color);
    font-family: Inter;
    font-size: var(--size-16);
    font-style: normal;
    font-weight: 400;
    letter-spacing: -0.301px;
    z-index: 9;
    position: relative;
}

.nav-year {
    display: block;
    color: var(--text-color);
    font-family: Lora;
    font-size: var(--size-20);
    font-style: normal;
    font-weight: 400;
    z-index: 9;
    letter-spacing: -0.301px;
    position: relative;
}

/* Colores cuando el item está activo */
.history-nav__item.is-active .nav-year,
.history-nav__item.is-active .nav-title {
    color: #ffffff;
}

/* ---------- CARD DERECHA (RESTO DEL DISEÑO) ---------- */

.history-content {
    flex: 1;
}

.history-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    display: none;
    border-radius: 9.619px;
    background: var(--blanco);
    box-shadow: 0 19.238px 24.048px -4.81px rgba(0, 0, 0, 0.10), 0 7.695px 9.619px -5.772px rgba(0, 0, 0, 0.10);
}

.history-card.is-active {
    display: flex;
    animation: historyFade 0.5s ease forwards;
}

.history-card__image {
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: var(--margin-section);
    border-top-left-radius: 9.619px;
    border-top-right-radius: 9.619px;

}

.history-card__image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
}

.image-overlay {
    position: relative;
    z-index: 2;
    color: var(--blanco);
}

.hero-amount { 
    color: var(--blanco);
    font-family: Lora;
    font-size: var(--size-30);
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: -0.301px;

}
.hero-title { 
    color:var(--blanco);
    font-family: Inter;
    font-size: var(--size-20);
    font-style: normal;
    font-weight: 300;
    line-height: normal;
    letter-spacing: -0.301px;
}

.history-card__body { 
    padding: var(--margin-section); 
    display: flex;
    flex-direction: column;
    gap: var(--margin-section);
    flex: 1;
}

.history-card__body .tag-outline {
    width: fit-content;
}

.history-card__footer {
    margin-bottom: 0;
    margin-top: auto;
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--padding-int);
    margin-bottom: var(--margin-section);
}

.progress-container > .progress-text {
    display: flex;
    justify-content: space-between;
    width: 100%; 
}

.progress-bar {
    height: 6px;
    background: var(--gris);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #172645 0%, #518EAA 100%);
    width: 0%; /* Controlado por JS */
    transition: width 0.6s ease;
}

.history-card__nav-btns {
    display: flex;
    align-items: center;
    gap: var(--padding-int);
}

@keyframes historyFade {
    from { opacity: 0; transform: translateY(0); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .history-container {
        flex-direction: column;
    }

    .history-nav {
        width: 100%;
    }

    .nav-title {
        display: none;
    }

    .history-nav__list::before {
       display: none;
    }

    .history-nav__list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: var(--padding-small);
    }

    .nav-amount {
        display: none;
    }

    .history-nav__item::after, .history-nav__item.is-active::after {
        left: 0;
    }

    .history-nav__item, .history-nav__item.is-active {
        min-height: auto;
        padding-left: calc(var(--padding-small) + 15px);
        padding-right: var(--padding-small);
    }

    .history-nav__item {
        margin-bottom: 0;
    }

    .history-nav__item.is-active::before {
        left: calc(-1 * var(--padding-int));
    }

    .nav-year {
        font-size: var(--size-10);
    }
}