:root {
    --primary-color: #00ff88;
    --secondary-color: #0066ff;
    --dark-color: #1a1a1a;
    --light-color: #ffffff;
    --gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--dark-color);
    color: var(--light-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    padding: var(--safe-area-inset-top) 0 var(--safe-area-inset-bottom);
}

/* Menú de navegación */
.menu {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: calc(10px + var(--safe-area-inset-top)) 20px 10px;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    color: var(--light-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-links a i {
    font-size: 1.1rem;
}

.nav-links a:hover, 
.nav-links a.active {
    background: var(--gradient);
    color: var(--dark-color);
}

/* Contenedor principal */
.container {
    margin-top: 80px; /* Espacio para el menú fijo */
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.calculator {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: pan-y pinch-zoom;
}

.input-group {
    margin-bottom: 20px;
}

.interest-container {
    display: flex;
    gap: 10px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--light-color);
    font-size: 16px;
    transition: all 0.3s ease;
    min-height: 44px;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

button {
    width: 100%;
    padding: 15px;
    background: var(--gradient);
    color: var(--dark-color);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
}

.api-button {
    width: auto;
    white-space: nowrap;
    padding: 12px;
    font-size: 14px;
}

.resultado {
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.result-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: pan-y;
    user-select: none;
}

.result-card h2 {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.result-card p {
    font-size: 24px;
    color: var(--light-color);
    font-weight: bold;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 50px 0 20px;
    margin-top: auto;
    margin-bottom: 70px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding: 0 20px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--light-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-icons a {
    color: var(--light-color);
    font-size: 20px;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(26, 26, 26, 0.95);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
    }

    .nav-links.active {
        display: flex;
    }

    .hamburger {
        display: block;
        cursor: pointer;
        font-size: 1.5rem;
        color: var(--primary-color);
    }

    .nav-links a {
        padding: 12px 16px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .resultado {
        grid-template-columns: 1fr;
    }

    .interest-container {
        flex-direction: column;
    }
}

/* Notificaciones */
.notificacion {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    background: var(--gradient);
    color: var(--dark-color);
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
    animation: slideIn 0.5s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    min-width: 280px;
    text-align: center;
}

.notificacion.error {
    background: linear-gradient(45deg, #ff4444, #ff6b6b);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

/* Modal de confirmación */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 102, 255, 0.1));
    padding: 30px;
    border-radius: 20px;
    max-width: 90%;
    width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-btn {
    padding: 12px 25px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.confirm {
    background: var(--gradient);
    color: var(--dark-color);
}

.modal-btn.cancel {
    background: linear-gradient(45deg, #ff4444, #ff6b6b);
    color: white;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Animaciones */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes modalFadeIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Estilos para el desglose del préstamo */
.desglose-container {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.desglose-container h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.desglose-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.desglose-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease;
    touch-action: pan-y;
    user-select: none;
}

.desglose-card:hover {
    transform: translateY(-5px);
}

.desglose-card h3 {
    color: var(--light-color);
    font-size: 1rem;
    margin-bottom: 10px;
}

.desglose-card p {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
}

/* Contenedor del gráfico */
.grafico-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    height: 300px;
}

/* Estilos para la tabla de amortización */
.tabla-container {
    margin: 20px -15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabla-container h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

#tabla-amortizacion {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

#tabla-amortizacion th,
#tabla-amortizacion td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#tabla-amortizacion th {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
}

#tabla-amortizacion tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Estilos para el comparador de escenarios */
.comparador-container {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.comparador-container h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.escenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.escenario-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    position: relative;
    transition: transform 0.3s ease;
    touch-action: pan-y;
    user-select: none;
}

.escenario-card:hover {
    transform: translateY(-5px);
}

.escenario-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.escenario-card p {
    color: var(--light-color);
    margin: 8px 0;
    font-size: 0.9rem;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border: none;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #ff4444;
    color: white;
}

.secondary-btn {
    background: var(--gradient);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    opacity: 1;
}

/* Responsive para tablets y móviles */
@media (max-width: 768px) {
    .desglose-grid {
        grid-template-columns: 1fr;
    }

    .tabla-container {
        margin: 20px -20px;
        padding: 0 20px;
    }

    #tabla-amortizacion {
        font-size: 0.9rem;
    }

    #tabla-amortizacion th,
    #tabla-amortizacion td {
        padding: 8px;
    }

    .escenarios-grid {
        grid-template-columns: 1fr;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.desglose-container,
.comparador-container,
.escenario-card {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Ajustes específicos para pantallas pequeñas */
@media (max-width: 380px) {
    h1 {
        font-size: 1.8rem;
    }

    .desglose-container h2,
    .comparador-container h2 {
        font-size: 1.3rem;
    }

    .result-card p {
        font-size: 1.2rem;
    }

    .interest-container {
        flex-direction: column;
    }

    .api-button {
        margin-top: 10px;
        width: 100%;
    }
}

/* Ajustes para la orientación horizontal */
@media (max-height: 600px) and (orientation: landscape) {
    .menu {
        padding: 5px 20px;
    }

    .nav-links {
        grid-template-columns: repeat(4, auto);
    }

    .nav-links i {
        margin-bottom: 0;
    }

    .nav-links span {
        display: none;
    }
}

/* Optimizaciones para PWA */
@media (display-mode: standalone) {
    body {
        padding-top: var(--safe-area-inset-top);
    }

    .menu {
        padding-bottom: max(10px, var(--safe-area-inset-bottom));
    }
}

/* Agregar pull-to-refresh visual */
@keyframes pullToRefresh {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(70px);
    }
}

/* Soporte para gestos */
.calculator {
    touch-action: pan-y pinch-zoom;
}

/* Mejorar la experiencia táctil */
.escenario-card, .desglose-card, .result-card {
    touch-action: pan-y;
    user-select: none;
} 






/* Footer */
.footer-bottom {
    background-color: #1a1a1a; /* Fondo oscuro */
    padding: 1.5rem;
    text-align: center;
    border-top: 2px solid #ff8c42; /* Borde naranja */
}

.footer-bottom h3 {
    margin: 0;
    font-size: 1.2rem;
}

.footer-bottom h3 a {
    color: #ff8c42; /* Naranja */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-bottom h3 a:hover {
    color: #e67e22; /* Naranja más oscuro al pasar el mouse */
}

.footer-bottom h3 a i {
    font-size: 1.5rem;
}

.footer-bottom p {
    margin: 0.5rem 0 0;
    color: #4caf50; /* Verde */
    font-size: 0.9rem;
}