/* Estilos generales del cuerpo */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f9f9f9;
    color: #333;
}

/* Contenedor principal del plugin */
.container-pana-pana {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Título principal */
h1 {
    color: #2e7d32;
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
}

/* Estilos para formularios */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2e7d32;
    font-size: 16px;
}

select, input[type="number"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: #2e7d32;
}

/* Contenedor de botones */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px auto;
}

button {
    padding: 14px 32px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    transition: all 0.3s;
}

/* Estilo para botón CALCULAR */
button:not(.btn-clear):not(.btn-pdf) {
    background-color: #2e7d32;
    color: white;
}

button:not(.btn-clear):not(.btn-pdf):hover {
    background-color: #1b5e20;
}

/* Estilo para botón LIMPIAR */
.btn-clear {
    background-color: #f44336;
    color: white;
}

.btn-clear:hover {
    background-color: #d32f2f;
}

/* Estilo para botón IMPRIMIR PDF */
.btn-pdf {
    background-color: #1976d2;
    color: white;
}

.btn-pdf:hover {
    background-color: #0d47a1;
}

/* Estilos para la sección de resumen (RESULTADO TOTAL solicitado) */
.result-summary {
    margin: 40px 0;
    padding: 25px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 10px;
    border-left: 5px solid #2e7d32;
}

.result-summary h2 {
    color: #1b5e20;
    margin-bottom: 20px;
    text-align: center;
}

.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.summary-box p {
    margin: 8px 0;
    padding: 10px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.summary-box strong {
    color: #2e7d32;
}

/* Estilos para la tabla de amortización */
.table-container {
    margin-top: 30px;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 12px 15px;
    text-align: left;
}

th {
    background-color: #2e7d32;
    color: white;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f5f5f5;
}

tr:hover {
    background-color: #e8f5e9;
}

tfoot td {
    font-weight: bold;
    background-color: #e8f5e9;
}

/* Clase para ocultar elementos */
.hidden {
    display: none;
}

/* Nota al pie */
.note {
    margin-top: 40px;
    padding: 15px;
    background-color: #fff3e0;
    border-left: 4px solid #fb8c00;
    color: #666;
    font-size: 14px;
    border-radius: 0 8px 8px 0;
}

/* ===== MEDIA QUERIES PARA DISPOSITIVOS MÓVILES ===== */

/* Teléfonos pequeños (hasta 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container-pana-pana {
        padding: 20px 15px;
        margin: 10px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    select, input[type="number"] {
        padding: 12px 10px;
        font-size: 15px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }

    .summary-box {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .summary-box p {
        font-size: 14px;
        padding: 8px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 6px;
    }

    .table-container {
        font-size: 13px;
    }

    tfoot td {
        font-size: 13px;
    }

    .note {
        font-size: 12px;
        padding: 10px;
    }
}

/* Teléfonos medianos y tablets pequeñas (hasta 768px) */
@media (max-width: 768px) {
    .container-pana-pana {
        padding: 25px;
        margin: 15px;
    }

    h1 {
        font-size: 24px;
    }

    select, input[type="number"] {
        padding: 13px;
        font-size: 15px;
    }

    .button-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    button {
        min-width: 180px;
        margin: 5px;
        font-size: 16px;
    }

    .summary-box {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 10px 8px;
    }

    .note {
        font-size: 13px;
    }
}

/* Tablets y pantallas pequeñas (hasta 992px) */
@media (max-width: 992px) {
    .container-pana-pana {
        padding: 30px 20px;
    }

    .summary-box {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }
}

/* Pantallas medianas (hasta 1200px) */
@media (max-width: 1200px) {
    .container-pana-pana {
        margin: 20px;
        padding: 35px 30px;
    }

    .summary-box {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ajustes adicionales para mejorar UX en móviles */

/* Evitar zoom al hacer focus en inputs (opcional, mejora UX) */
input[type="number"] {
    font-size: 16px;
}

/* Estilo para scroll horizontal en móviles */
.table-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* Ajustar espaciado en resumen para móviles */
.result-summary {
    padding: 20px 15px;
}

.result-summary h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

/* Mejorar legibilidad en tablas pequeñas */
#amortization-table {
    white-space: nowrap;
}

/* Ajustar tamaño de fuente en celdas cuando el espacio es limitado */
@media (max-width: 600px) {
    #amortization-table th,
    #amortization-table td {
        font-size: 12px;
        padding: 6px 4px;
    }
    
    #amortization-table th {
        font-weight: 600;
    }
}

/* Ajustar márgenes en pantallas muy pequeñas */
@media (max-width: 360px) {
    .container-pana-pana {
        margin: 5px;
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .button-group {
        margin: 20px auto 15px;
    }
    
    .result-summary, .result {
        margin: 25px 0;
        padding: 15px 10px;
    }
    
    .note {
        margin-top: 30px;
        font-size: 12px;
        padding: 12px 10px;
    }
}