/* --- Variables Generales (Tema Azul Moderno para la web) --- */
:root {
    --primary-color: #2563eb;       /* Azul Principal */
    --primary-hover: #1d4ed8;       /* Azul Oscuro (Hover) */
    --bg-body: #f3f4f6;             /* Fondo suave */
    --bg-card: #ffffff;             /* Tarjetas blancas */
    --text-main: #1f2937;           
    --text-muted: #6b7280;          
    --border-color: #d1d5db;        /* Bordes grises para el formulario */
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif; /* Tu fuente favorita */
    margin: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

/* --- Tipografía General --- */
h1 { font-size: 24px; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
h2 { font-size: 15px; font-weight: 400; color: var(--text-muted); margin-top: 0; margin-bottom: 25px; }
h3 { font-size: 14px; font-weight: 600; color: var(--text-main); margin: 0; min-width: 150px; }
p { font-size: 16px; color: var(--text-muted); }

/* --- Header & Nav --- */
header {
    background-color: var(--bg-card);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
}

.logo img { height: 50px; }
.logo h1 { font-size: 22px; margin: 0; color: black; }
header a { text-decoration: none; color: black; font-weight: bold; }

/* --- SECCIÓN FORMULARIO (Estilo Azul/Moderno) --- */
#calculo .container {
    width: 90%;
    max-width: 550px;
    background-color: var(--bg-card);
    border-radius: 16px; /* Bordes redondeados */
    box-shadow: var(--shadow-soft);
    padding: 40px;
    text-align: center;
    margin: 60px auto; 
    border: 1px solid white;
}

#calculo .subcontainer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    text-align: left;
}

#calculo .textbox {
    font-family: inherit;
    font-size: 14px;
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Inputs redondos */
    padding: 10px 15px;
    width: 100%; 
    max-width: 280px;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s;
}

#calculo .textbox:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.submit {
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 30px;
    border: 0;
    color: white;
    background-color: var(--primary-color);
    border-radius: 8px;
    margin-top: 25px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.4);
}
.submit:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.recommendation-box {
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 5px;
    margin: 5px 0 20px 0;
}
#recomendacion { color: var(--primary-color); font-weight: bold; }

/* =================================================================
   SECCIÓN DE TABLA / RESULTADOS (ESTILO ESTRICTO / NEGRO)
   Esta parte ignora el estilo azul y usa bordes negros sólidos
   ================================================================= */

#resultado .container {
    display: flex;
    justify-content: center;
    flex-direction: column;
    max-width: 1000px;
    /* Reducimos margen superior para quitar espacios extra al imprimir */
    margin: 20px auto; 
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

#tabla2 {
    margin-top: 10px;
    overflow-x: auto;
}

/* --- TABLA TÉCNICA (Bordes Negros Sólidos) --- */
.tablaCalc {
    border-collapse: collapse; /* Bordes unidos */
    margin: 0 auto;
    font-size: 13px;
    width: 100%;
    min-width: 600px;
    /* BORDE NEGRO EXTERIOR */
    border: 2px solid black; 
    color: black; /* Texto negro forzado */
}

/* Cabecera de Tabla (Negra tipo Excel/Reporte) */
.tablaCalc thead tr {
    background-color: black; 
    color: white;
    text-align: center;
    border-bottom: 2px solid black;
}

/* Celdas Individuales (Bordes Negros Sólidos) */
.tablaCalc th, .tablaCalc td {
    padding: 10px 12px;
    border: 1px solid black !important; /* Forzamos borde negro */
    text-align: right; /* Alineación numérica correcta */
}

/* Primera columna centrada (Número de cuota) */
.tablaCalc td:first-child, .tablaCalc th:first-child {
    text-align: center;
    background-color: #f3f3f3;
    font-weight: bold;
}

/* Filas alternas limpias */
.tablaCalc tbody tr { background-color: #ffffff; }
.tablaCalc tbody tr:nth-of-type(even) { background-color: #f2f2f2; }
.tablaCalc tbody tr:hover { background-color: #e5e7eb; }

/* --- Historial (Cards) --- */
#historial .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 700px;
    margin: 40px auto;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.card-item {
    width: 100%;
    margin: 15px 0;
    display: flex;
    flex-direction: row;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-info { width: 60%; text-align: center; padding: 20px; }
.card-img {
    width: 40%;
    background-color: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
}
.card-img img { height: 70px; object-fit: contain; }

/* --- Footer --- */
footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    padding: 20px 0;
}
footer .container { display: flex; justify-content: center; }

/* Responsive */
@media (max-width: 700px) {
    #calculo .container {
        width: 100%;
        margin-top: 20px;
        box-shadow: none;
        background-color: transparent;
        border: none;
        padding: 20px 10px;
    }
    #calculo .subcontainer { flex-direction: column; align-items: flex-start; gap: 5px; }
    #calculo .textbox { max-width: 100%; margin-left: 0; }
    .tablaCalc th, .tablaCalc td { padding: 5px; font-size: 11px; }
}

/* Quitar flechas inputs number */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; margin: 0; 
}