/* ==========================================
   CALCULATOR.CSS - Estilos específicos para páginas de calculadoras
   ========================================== */

/* Sección de la calculadora */
.calculator-section {
    background: var(--background-alt);
    padding: 3rem 1.5rem;
    margin: 2rem 0;
}

.calculator-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.calculator-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--background-alt);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.calculator-placeholder h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

/* Contenido de la página de calculadora */
.content-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.content-section h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    margin-top: 3rem;
}

.content-section h2:first-child {
    margin-top: 0;
}

.content-section h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.content-section p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.content-section ul,
.content-section ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.content-section li {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.content-section strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Cajas informativas */
.info-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.info-box p {
    margin-bottom: 0.5rem;
}

.warning-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.warning-box h4 {
    color: #f59e0b;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.success-box {
    background: #dcfce7;
    border-left: 4px solid var(--secondary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.success-box h4 {
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.formula-box {
    background: #f9fafb;
    border: 2px solid var(--border-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.formula-box h4 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.formula-box p {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin: 0.5rem 0;
}

/* Contenedor de tabla con scroll horizontal */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Tabla de comparación */
.comparison-table {
    width: 100%;
    min-width: 100%;
    /* Flexible, se ajusta al contenedor */
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    /* Sin margin porque el wrapper ya lo tiene */
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table thead {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    color: white;
}

.comparison-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table tbody tr:hover {
    background: var(--background-alt);
}

.comparison-table tbody tr:last-child {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}

.comparison-table tbody tr:last-child td {
    border-bottom: none;
    font-weight: 600;
}

/* Sección de FAQs */
.faq-section {
    background: var(--background-alt);
    padding: 4rem 1.5rem;
    margin-top: 4rem;
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.faq-question {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.faq-question::before {
    content: "Q";
    background: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.875rem;
}

.faq-answer {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-light);
    padding-left: 2.5rem;
}

/* ==========================================
   FORMULARIO DE CALCULADORA MODERNO
   ========================================== */
.calculator-intro {
    text-align: center;
    margin-bottom: 2.5rem;
}

.calculator-intro h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.calculator-intro p {
    color: var(--text-light);
    font-size: 1.05rem;
}

.calculator-form-modern {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-card {
    background: var(--background-alt);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.form-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.form-card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.form-card-content {
    width: 100%;
}

.form-card label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-card input,
.form-card select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.3s ease;
    background: white;
}

.form-card input:focus,
.form-card select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-with-currency {
    position: relative;
}

.currency-symbol {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-light);
    pointer-events: none;
}

/* Opciones avanzadas */
.advanced-options {
    margin: 1.5rem 0;
}

.toggle-advanced {
    width: 100%;
    padding: 1rem;
    background: var(--background-alt);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.toggle-advanced:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-advanced.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   RESULTADOS MODERNOS
   ========================================== */
.results-modern {
    margin-top: 3rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.results-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-main {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    line-height: 1;
}

.result-sublabel {
    font-size: 1.125rem;
    opacity: 0.9;
}

.results-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.breakdown-item {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.breakdown-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.breakdown-item.highlight {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: var(--secondary-color);
}

.breakdown-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.breakdown-content {
    flex: 1;
}

.breakdown-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.breakdown-item.highlight .breakdown-label {
    color: #065f46;
}

.breakdown-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.breakdown-item.highlight .breakdown-value {
    color: #047857;
}

/* Timeline Summary */
.timeline-summary {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    border: 2px solid var(--border-color);
}

.timeline-summary h3 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.timeline-items {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--background-alt);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.timeline-year {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.timeline-amount {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.25rem;
}

.btn-show-full-table {
    width: 100%;
    padding: 1rem;
    background: var(--background-alt);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-show-full-table:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.full-projection {
    margin-top: 1.5rem;
    animation: slideDown 0.3s ease;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {

    /* Sección de calculadora */
    .calculator-section {
        padding: 2rem 1rem;
    }

    .calculator-container {
        padding: 1.5rem;
    }

    /* Intro */
    .calculator-intro {
        margin-bottom: 1.5rem;
    }

    .calculator-intro h2 {
        font-size: 1.25rem;
    }

    .calculator-intro p {
        font-size: 0.9rem;
    }

    /* Tabla de comparación */
    .table-wrapper {
        margin: 1.5rem -1.5rem;
        /* Negativo para usar todo el ancho del container */
        border-radius: 0;
        box-shadow: none;
    }

    .comparison-table {
        min-width: 100%;
        font-size: 0.75rem;
        table-layout: fixed;
        /* Distribuir columnas equitativamente */
    }

    .comparison-table th {
        padding: 0.6rem 0.25rem;
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .comparison-table td {
        padding: 0.6rem 0.25rem;
        font-size: 0.75rem;
    }

    /* Hacer columnas más estrechas */
    .comparison-table th:first-child,
    .comparison-table td:first-child {
        width: 20%;
    }

    .comparison-table th:nth-child(2),
    .comparison-table td:nth-child(2),
    .comparison-table th:nth-child(3),
    .comparison-table td:nth-child(3) {
        width: 28%;
    }

    .comparison-table th:nth-child(4),
    .comparison-table td:nth-child(4) {
        width: 24%;
    }

    /* Formulario */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-card {
        padding: 1rem;
    }

    .form-card-icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .form-card label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .form-card input,
    .form-card select {
        padding: 0.6rem;
        font-size: 1.1rem;
    }

    .currency-symbol {
        font-size: 0.95rem;
        right: 0.75rem;
    }

    /* Opciones avanzadas */
    .toggle-advanced {
        padding: 0.85rem;
        font-size: 0.9rem;
    }

    /* Resultados */
    .results-modern {
        margin-top: 2rem;
    }

    .results-hero {
        padding: 2rem 1.5rem;
    }

    .result-label {
        font-size: 0.85rem;
    }

    .result-main {
        font-size: 2.25rem;
    }

    .result-sublabel {
        font-size: 0.95rem;
    }

    /* Breakdown */
    .results-breakdown {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .breakdown-item {
        padding: 1rem;
    }

    .breakdown-icon {
        font-size: 1.5rem;
    }

    .breakdown-label {
        font-size: 0.8rem;
    }

    .breakdown-value {
        font-size: 1.25rem;
    }

    /* Timeline */
    .timeline-summary {
        padding: 1.5rem;
    }

    .timeline-summary h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .timeline-item {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .timeline-year {
        font-size: 0.95rem;
    }

    .timeline-amount {
        font-size: 1.1rem;
    }

    .btn-show-full-table {
        padding: 0.85rem;
        font-size: 0.9rem;
    }

    /* Tabla */
    .projection-table {
        font-size: 0.8rem;
    }

    .projection-table th,
    .projection-table td {
        padding: 0.6rem 0.4rem;
    }

    .projection-table th {
        font-size: 0.7rem;
        padding: 0.75rem 0.4rem;
    }

    .projection-table tbody tr:last-child td {
        font-size: 0.85rem;
    }
}

/* Para pantallas muy pequeñas (< 400px) */
@media (max-width: 400px) {
    .calculator-container {
        padding: 1rem;
    }

    .result-main {
        font-size: 2rem;
    }

    .form-card input,
    .form-card select {
        font-size: 1rem;
    }

    .projection-table {
        font-size: 0.75rem;
    }

    .projection-table th,
    .projection-table td {
        padding: 0.5rem 0.3rem;
    }
}

/* ==========================================
   TABLA DE PROYECCIÓN
   ========================================== */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.projection-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.projection-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.projection-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.projection-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.projection-table tbody tr {
    transition: background-color 0.2s ease;
}

.projection-table tbody tr:hover {
    background: #f9fafb;
}

.projection-table tbody tr:last-child td {
    border-bottom: none;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    font-weight: 700;
    font-size: 1rem;
}

.projection-table tbody tr:last-child td:first-child::before {
    content: "🎯 ";
}

.highlight-amount {
    color: var(--secondary-color);
    font-weight: 600;
}

.projection-table td:nth-child(4) {
    font-weight: 600;
    color: var(--primary-color);
}