/* ============================================
   VARIABLES — Regla 60-30-10 (Verde Aceituna)
   ============================================ */
:root {
    --color-dominante: #F8F9FA;
    --color-secundario: #1E293B;
    --color-acento: #556B2F;
    --color-acento-hover: #6B8438;

    --color-texto-dark: #0F172A;
    --color-texto-light: #FFFFFF;
    --color-card-bg: #FFFFFF;
    --color-border: #E2E8F0;
    --color-muted: #64748B;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition: all 0.25s ease;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-main);
    background-color: var(--color-dominante);
    color: var(--color-texto-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.95rem;
    transition: var(--transition);
    white-space: nowrap; border: 2px solid transparent;
}
.btn--primary { background-color: var(--color-acento); color: var(--color-texto-light); }
.btn--primary:hover { background-color: var(--color-acento-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost { background-color: transparent; color: var(--color-secundario); }
.btn--ghost:hover { background-color: rgba(85, 107, 47, 0.1); color: var(--color-acento); }
.btn--outline { background-color: transparent; color: var(--color-secundario); border-color: var(--color-border); }
.btn--outline:hover { border-color: var(--color-acento); color: var(--color-acento); }
.btn--lg { padding: 0.9rem 1.8rem; font-size: 1rem; }
.btn--block { width: 100%; }

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background-color: rgba(248, 249, 250, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}
.navbar__container {
    max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.navbar__brand {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 1.25rem; font-weight: 700; color: var(--color-secundario);
}
.navbar__logo { width: 36px; height: 36px; }
.navbar__name strong { color: var(--color-acento); }
.navbar__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ============================================
   HERO
   ============================================ */
.hero {
    padding: 5rem 1.5rem 4rem; text-align: center;
    background: linear-gradient(180deg, var(--color-dominante) 0%, #EEF0E8 100%);
}
.hero__content { max-width: 760px; margin: 0 auto; }
.hero__badge {
    display: inline-block;
    background-color: rgba(85, 107, 47, 0.12);
    color: var(--color-acento);
    font-weight: 600; font-size: 0.85rem;
    padding: 0.4rem 1rem; border-radius: 999px;
    margin-bottom: 1.2rem;
}
.hero__title {
    font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800;
    line-height: 1.15; color: var(--color-secundario);
    margin-bottom: 1rem; letter-spacing: -0.02em;
}
.hero__subtitle { font-size: 1.1rem; color: var(--color-muted); margin-bottom: 2rem; }
.hero__cta { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ============================================
   SECCIONES GENÉRICAS
   ============================================ */
section { padding: 4rem 1.5rem; }
.section__header { text-align: center; margin-bottom: 3rem; }
.section__title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 700; color: var(--color-secundario); margin-bottom: 0.5rem; }
.section__subtitle { color: var(--color-muted); font-size: 1.05rem; }

/* ============================================
   LÍNEAS DE CRÉDITO
   ============================================ */
.lineas__grid {
    max-width: 1280px; margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.lineas__loader {
    max-width: 400px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.lineas__error {
    max-width: 500px; margin: 0 auto; text-align: center;
    background-color: rgba(239, 68, 68, 0.08);
    border-left: 4px solid #DC2626;
    padding: 1rem 1.5rem; border-radius: var(--radius-sm);
    color: #991B1B; font-weight: 500;
}

.card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.8rem 1.5rem;
    display: flex; flex-direction: column; gap: 0.8rem;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.card::before {
    content: ""; position: absolute; top: 0; left: 0;
    width: 100%; height: 4px;
    background-color: var(--color-acento);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.3s ease;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-acento);
}
.card:hover::before { transform: scaleX(1); }

.card__icon { font-size: 2rem; }
.card__icon img { width: 32px; height: 32px; }
.card__title { font-size: 1.25rem; color: var(--color-secundario); font-weight: 700; }
.card__desc { color: var(--color-muted); font-size: 0.95rem; flex-grow: 1; }
.card__features {
    list-style: none; display: flex; flex-direction: column;
    gap: 0.4rem; font-size: 0.9rem;
}
.card__features span { font-weight: 600; color: var(--color-secundario); }
.card__btn { margin-top: 0.5rem; }

/* Card destacada */
.card--featured {
    border-color: var(--color-acento);
    box-shadow: 0 0 0 2px rgba(85, 107, 47, 0.15), var(--shadow-md);
}
.card--featured::after {
    content: "Recomendada";
    position: absolute; top: 12px; right: -32px;
    background-color: var(--color-acento);
    color: var(--color-texto-light);
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.25rem 2.5rem;
    transform: rotate(35deg);
    text-transform: uppercase;
}

/* ============================================
   SIMULADOR
   ============================================ */
.simulador__wrapper {
    max-width: 1200px; margin: 0 auto;
    display: grid; grid-template-columns: 1fr; gap: 2rem;
}
@media (min-width: 900px) {
    .simulador__wrapper { grid-template-columns: 380px 1fr; align-items: start; }
}
.simulador__form {
    background-color: var(--color-card-bg);
    padding: 1.8rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex; flex-direction: column; gap: 1.2rem;
    border: 1px solid var(--color-border);
}
.form__group { display: flex; flex-direction: column; gap: 0.4rem; }
.form__group label { font-weight: 600; font-size: 0.9rem; color: var(--color-secundario); }
.form__group input,
.form__group select {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem; font-family: inherit;
    background-color: var(--color-dominante);
    transition: var(--transition);
}
.form__group input:focus,
.form__group select:focus {
    outline: none; border-color: var(--color-acento);
    box-shadow: 0 0 0 3px rgba(85, 107, 47, 0.15);
    background-color: #FFFFFF;
}
.form__hint { font-size: 0.8rem; color: var(--color-muted); }

.simulador__result {
    background-color: var(--color-card-bg);
    padding: 1.8rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result__summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
    padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border);
}
.result__item { display: flex; flex-direction: column; gap: 0.3rem; }
.result__label { font-size: 0.85rem; color: var(--color-muted); font-weight: 500; }
.result__value { font-size: 1.35rem; font-weight: 700; color: var(--color-acento); }

.result__table-wrapper {
    max-height: 420px; overflow-y: auto;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border);
}
.result__table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.result__table thead {
    position: sticky; top: 0;
    background-color: var(--color-secundario);
    color: var(--color-texto-light); z-index: 1;
}
.result__table th, .result__table td {
    padding: 0.6rem 0.8rem; text-align: right; white-space: nowrap;
}
.result__table th:first-child, .result__table td:first-child { text-align: center; }
.result__table tbody tr:nth-child(even) { background-color: var(--color-dominante); }
.result__table tbody tr:hover { background-color: rgba(85, 107, 47, 0.08); }

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: var(--color-secundario);
    color: var(--color-texto-light);
    padding: 3rem 1.5rem 1.5rem;
}
.footer__container {
    max-width: 1200px; margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem; padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer__brand { font-size: 1.2rem; margin-bottom: 0.6rem; }
.footer__brand strong { color: #A8C46B; }
.footer__col h4 { font-size: 1rem; margin-bottom: 0.8rem; color: #A8C46B; }
.footer__col p, .footer__col a {
    display: block; font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.4rem; transition: var(--transition);
}
.footer__col a:hover { color: var(--color-texto-light); }
.footer__bottom {
    max-width: 1200px; margin: 1.5rem auto 0;
    text-align: center; font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   LOADER
   ============================================ */
.loader { display: flex; gap: 0.5rem; justify-content: center; padding: 1rem 0; }
.loader span {
    width: 12px; height: 12px; border-radius: 50%;
    background-color: var(--color-acento);
    animation: bounce 1.2s infinite ease-in-out;
}
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ============================================
   MODAL — ESTADO DEL CRÉDITO
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem; animation: fadeIn 0.25s ease;
}
.modal-overlay[hidden] { display: none; }

.modal {
    position: relative; width: 100%; max-width: 620px;
    max-height: 92vh; overflow-y: auto;
    background-color: var(--color-card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.2rem 2rem;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.modal__close {
    position: absolute; top: 1rem; right: 1rem;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 1.6rem; line-height: 1; color: var(--color-muted);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal__close:hover { background-color: var(--color-dominante); color: var(--color-secundario); }

.modal__body { display: flex; flex-direction: column; gap: 1.6rem; }
.modal__body[hidden] { display: none; }
.modal__body--center { align-items: center; text-align: center; padding: 1rem 0; }
.modal__header { text-align: center; display: flex; flex-direction: column; gap: 0.5rem; }

.modal__icon {
    width: 60px; height: 60px; margin: 0 auto 0.4rem;
    border-radius: 50%;
    background-color: rgba(85, 107, 47, 0.12);
    color: var(--color-acento);
    font-size: 1.8rem;
    display: flex; align-items: center; justify-content: center;
}
.modal__icon--success { background-color: rgba(34, 197, 94, 0.15); color: #16A34A; }
.modal__icon--error   { background-color: rgba(239, 68, 68, 0.15); color: #DC2626; }

.modal__title { font-size: 1.5rem; font-weight: 700; color: var(--color-secundario); }
.modal__subtitle { font-size: 0.95rem; color: var(--color-muted); line-height: 1.55; }
.modal__form { display: flex; flex-direction: column; gap: 1.1rem; }
.modal__actions { display: flex; gap: 0.7rem; justify-content: space-between; margin-top: 0.4rem; }
.modal__actions--end { justify-content: flex-end; }
.modal__error {
    font-size: 0.88rem; color: #DC2626;
    background-color: rgba(239, 68, 68, 0.08);
    padding: 0.7rem 1rem; border-radius: var(--radius-sm);
    border-left: 3px solid #DC2626;
}
.modal__error[hidden] { display: none; }

.estado-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem;
}
@media (max-width: 520px) { .estado-grid { grid-template-columns: 1fr; } }

.estado-card {
    background-color: var(--color-dominante);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    display: flex; flex-direction: column; gap: 0.3rem;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.estado-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px; background-color: var(--color-border);
}
.estado-card:hover {
    border-color: var(--color-acento);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.estado-card--accent::before { background-color: var(--color-acento); }
.estado-card--ok::before     { background-color: #16A34A; }
.estado-card--warn::before   { background-color: #F59E0B; }

.estado-card__label {
    font-size: 0.78rem; font-weight: 600; color: var(--color-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.estado-card__value {
    font-size: 1.1rem; font-weight: 700; color: var(--color-secundario);
    word-break: break-word;
}
.estado-card--ok     .estado-card__value { color: #16A34A; }
.estado-card--warn   .estado-card__value { color: #D97706; }
.estado-card--accent .estado-card__value { color: var(--color-acento); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .navbar__container { justify-content: center; }
    .navbar__actions { width: 100%; justify-content: center; }
    .navbar__actions .btn { flex: 1; font-size: 0.85rem; padding: 0.6rem 0.8rem; }
    .hero { padding: 3rem 1rem 2.5rem; }
    section { padding: 3rem 1rem; }
}