/* Reset básico para evitar márgenes y rellenos inesperados */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilos generales del cuerpo */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1f2937;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Estilos del encabezado */
header {
    background-color: #1e40af;
    color: white;
    text-align: center;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-word; /* Permite que el texto se divida en líneas */
}

nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap; /* Permite que los enlaces se ajusten en pantallas pequeñas */
}

nav a {
    color: #e0e7ff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.25rem 0.5rem; /* Añade padding para mejor clic */
}

nav a:hover {
    color: #ffffff;
}

/* Contenedor principal */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* Estilos de secciones */
section {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    word-wrap: break-word; /* Asegura que el texto se ajuste */
}

section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 1rem;
}

section h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

section p {
    font-size: 1rem;
    color: #4b5563;
    word-break: break-word; /* Asegura que el texto largo se divida */
}

/* Estilos para valores dinámicos (UMA) */
#uma-diaria, #uma-mensual {
    font-weight: 700;
    color: #1e40af;
}

/* Estilos para la tabla INPC */
#inpc-table-container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

#inpc-table-container th, #inpc-table-container td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

#inpc-table-container th:nth-child(1), #inpc-table-container td:nth-child(1) {
    width: 50%;
    text-align: left;
}

#inpc-table-container th:nth-child(2), #inpc-table-container td:nth-child(2) {
    width: 50%;
    text-align: right;
}

#inpc-table-container th {
    background-color: #1e40af;
    color: #ffffff;
    font-weight: 600;
}

#inpc-table-container tr:nth-child(even) {
    background-color: #f9fafb;
}

#inpc-table-container tr:hover {
    background-color: #f1f5f9;
}

/* Estilos para calculadoras */
#calculadoras div {
    margin-bottom: 1.5rem;
}

#calculadoras h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

input[type="number"] {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

button {
    background-color: #1e40af;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 0.5rem;
}

button:hover {
    background-color: #1e3a8a;
}

/* Resultados de las calculadoras */
#isr-resultado, #iva-resultado, #subsidio-resultado {
    font-weight: 700;
    color: #1e40af;
}

/* Estilos para las tablas ISR y subsidio */
#tablas-isr .selector {
    margin-bottom: 1.5rem;
}

#tablas-isr select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #ffffff;
    cursor: pointer;
    width: 100%; /* Ajuste para móviles */
}

#tablas-isr table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

#tablas-isr th, #tablas-isr td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
}

#tablas-isr th:nth-child(1), #tablas-isr td:nth-child(1) {
    width: 25%;
}

#tablas-isr th:nth-child(2), #tablas-isr td:nth-child(2) {
    width: 25%;
}

#tablas-isr th:nth-child(3), #tablas-isr td:nth-child(3) {
    width: 25%;
}

#tablas-isr th:nth-child(4), #tablas-isr td:nth-child(4) {
    width: 25%;
}

#tablas-isr th {
    background-color: #1e40af;
    color: #ffffff;
    font-weight: 600;
}

#tablas-isr tr:nth-child(even) {
    background-color: #f9fafb;
}

#tablas-isr tr:hover {
    background-color: #f1f5f9;
}

/* Estilos específicos para la tabla de subsidio */
#tablas-isr h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #1f2937;
    margin: 1.5rem 0 0.5rem;
}

/* Estilos para la calculadora de subsidio */
#subsidio-calculator {
    margin-top: 1.5rem;
}

#subsidio-calculator h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

#subsidio-calculator input[type="number"] {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#subsidio-calculator input[type="number"]:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

#subsidio-calculator button {
    background-color: #1e40af;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 0.5rem;
}

#subsidio-calculator button:hover {
    background-color: #1e3a8a;
}

/* Estilos para la sección "Por qué elegirnos" */
#why-choose p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Estilos para el footer */
footer {
    background-color: #1e3a8a;
    color: #d1d5db;
    padding: 3rem 1.5rem;
    text-align: center;
    border-top: 2px solid #1e40af;
    width: 100%;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-content h3 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
}

.footer-content h3 a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content h3 a:hover {
    color: #e0e7ff;
}

.footer-content p {
    font-size: 1rem;
    color: #d1d5db;
    margin-bottom: 1rem;
    text-align: center;
    max-width: 100%;
}

.footer-content a.social-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.footer-content a.social-link:hover {
    color: #e0e7ff;
}

.footer-content a.social-link svg {
    fill: currentColor;
    width: 16px;
    height: 16px;
}

.footer-links {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap; /* Permite que los enlaces se ajusten */
}

.footer-links a {
    font-size: 1rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #e0e7ff;
}

.footer-content .copyright {
    font-size: 0.9rem;
    color: #d1d5db;
    margin-top: 1rem;
}

/* Estilos para el interruptor de modo oscuro */
#dark-mode-toggle {
    background-color: #1e40af;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 1rem;
}

#dark-mode-toggle:hover {
    background-color: #1e3a8a;
}

/* Modo oscuro */
body.dark-mode {
    background-color: #1f2937;
    color: #e5e7eb;
}

body.dark-mode header {
    background-color: #374151;
}

body.dark-mode header h1,
body.dark-mode nav a {
    color: #e5e7eb;
}

body.dark-mode nav a:hover {
    color: #ffffff;
}

body.dark-mode section {
    background-color: #2d3748;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode section h2 {
    color: #93c5fd;
}

body.dark-mode section h3 {
    color: #d1d5db;
}

body.dark-mode section p,
body.dark-mode #uma-diaria,
body.dark-mode #uma-mensual,
body.dark-mode #isr-resultado,
body.dark-mode #iva-resultado,
body.dark-mode #subsidio-resultado {
    color: #e5e7eb;
}

body.dark-mode #inpc-table-container th {
    background-color: #4b5563;
    color: #e5e7eb;
}

body.dark-mode #inpc-table-container tr:nth-child(even),
body.dark-mode #tablas-isr tr:nth-child(even) {
    background-color: #374151;
}

body.dark-mode #inpc-table-container tr:hover,
body.dark-mode #tablas-isr tr:hover {
    background-color: #4b5563;
}

body.dark-mode input[type="number"] {
    background-color: #4b5563;
    border-color: #6b7280;
    color: #e5e7eb;
}

body.dark-mode input[type="number"]:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}

body.dark-mode button,
body.dark-mode #subsidio-calculator button {
    background-color: #4b5563;
    color: #e5e7eb;
}

body.dark-mode button:hover,
body.dark-mode #subsidio-calculator button:hover {
    background-color: #6b7280;
}

body.dark-mode #tablas-isr th {
    background-color: #4b5563;
    color: #e5e7eb;
}

body.dark-mode footer {
    background-color: #111827;
    border-top-color: #4b5563;
}

body.dark-mode .footer-content h3,
body.dark-mode .footer-content h3 a,
body.dark-mode .footer-links a,
body.dark-mode .footer-content a.social-link {
    color: #e5e7eb;
}

body.dark-mode .footer-content h3 a:hover,
body.dark-mode .footer-links a:hover,
body.dark-mode .footer-content a.social-link:hover {
    color: #93c5fd;
}

body.dark-mode .footer-content p,
body.dark-mode .footer-content .copyright {
    color: #d1d5db;
}

body.dark-mode #tablas-isr select {
    background-color: #4b5563;
    border-color: #6b7280;
    color: #e5e7eb;
}

/* Diseño responsivo */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    section {
        padding: 1rem;
    }

    input[type="number"], #tablas-isr select, #subsidio-calculator input[type="number"] {
        max-width: 100%;
    }

    #inpc-table-container table, #tablas-isr table {
        font-size: 0.85rem;
    }

    #inpc-table-container th, #inpc-table-container td,
    #tablas-isr th, #tablas-isr td {
        padding: 0.5rem;
    }

    #why-choose p {
        font-size: 0.95rem;
    }

    .footer-content h3 {
        font-size: 1.4rem;
    }

    .footer-content p {
        font-size: 0.95rem;
    }

    .footer-links {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.2rem;
    }

    nav a {
        font-size: 0.9rem;
        padding: 0.2rem 0.3rem;
    }

    section h2 {
        font-size: 1.2rem;
    }

    button, #subsidio-calculator button {
        width: 100%;
        padding: 0.75rem;
    }

    #inpc-table-container table, #tablas-isr table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    #inpc-table-container th, #inpc-table-container td,
    #tablas-isr th, #tablas-isr td {
        min-width: 100px;
    }

    #why-choose p {
        font-size: 0.9rem;
    }

    footer {
        padding: 2rem 1rem;
    }

    .footer-content h3 {
        font-size: 1.2rem;
    }

    .footer-content p {
        font-size: 0.9rem;
        padding: 0 0.5rem;
    }

    .footer-content a.social-link svg {
        width: 14px;
        height: 14px;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer-content .copyright {
        font-size: 0.85rem;
    }

    #dark-mode-toggle {
        margin-top: 0.5rem;
        width: 100%;
        margin-left: 0;
    }
}