/* Estilos personalizados y para impresión */
body {
    font-family: 'Inter', sans-serif; /* Tailwind usa Inter por defecto, pero lo especificamos */
    transition: background-color 0.3s ease;
    background-color: #0f172a; /* bg-slate-900 - Mantener consistencia con el tema oscuro */
    color: #e2e8f0; /* text-slate-200 */
}

.step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    background-color: #1e293b; /* bg-slate-800 */
    border-radius: 0.5rem;
    border: 1px solid #334155; /* border-slate-700 */
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-bar-fill {
    transition: width 0.3s ease-in-out;
}

/* Clases para control de visibilidad en pantalla e impresión */
.print-only {
    display: none;
}

@media screen {
    .no-screen {
        display: none !important;
    }
}

label {
    margin-bottom: 0.25rem;
    display: block;
    font-weight: 500;
    color: #cbd5e1; /* text-slate-300 */
}

input[type="number"], 
input[type="text"], 
select {
    width: 100%;
    padding: 0.75rem;
    background-color: #1e293b; /* bg-slate-800 */
    border: 1px solid #334155; /* border-slate-700 */
    border-radius: 0.375rem; /* rounded-md */
    margin-bottom: 1rem;
    box-sizing: border-box;
    color: #f8fafc; /* text-slate-100 - Texto claro para contraste */
}

input[type="radio"], 
input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #3b82f6; /* blue-500 */
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23e2e8f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #3b82f6; /* blue-500 */
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.radio-group label {
    font-weight: normal;
    margin-right: 1rem;
    display: inline-block; /* Asegurar que se vean bien */
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    border: none; /* Asegurar que no haya borde por defecto */
}

.btn-primary {
    background-color: #2563EB; /* blue-600 */
    color: white;
}

.btn-primary:hover {
    background-color: #1D4ED8; /* blue-700 */
}

.btn-secondary {
    background-color: #334155; /* slate-700 */
    color: #e2e8f0; /* text-slate-200 */
}

.btn-secondary:hover {
    background-color: #475569; /* slate-600 */
}

.info-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-color: #9CA3AF; /* gray-400 */
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1rem;
    cursor: help;
    margin-left: 0.25rem;
    vertical-align: middle; /* Alinear mejor con el texto */
}

.tooltip {
    position: relative;
    display: inline-block;
}

/* Estilos para las secciones de resultados y contenedores */
.bg-white {
    background-color: #1e293b !important; /* bg-slate-800 */
    color: #e2e8f0 !important; /* text-slate-200 */
}

.bg-slate-50 {
    background-color: #334155 !important; /* slate-700 */
}

.text-slate-600, .text-slate-700, .text-slate-800 {
    color: #e2e8f0 !important; /* text-slate-200 */
}

.text-slate-500 {
    color: #94a3b8 !important; /* text-slate-400 */
}

.border {
    border-color: #334155 !important; /* border-slate-700 */
}

.bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.25) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    color: #f8fafc !important;
    padding: 1.5rem !important;
    border-radius: 0.5rem !important;
    margin-bottom: 1.5rem !important;
}

.text-blue-700 {
    color: #60a5fa !important; /* text-blue-400 */
}

/* Estilos específicos para el paso final y sección de impresión */
#step-5, #step-6, #print-section, #print-section-container {
    background-color: #1e293b !important; /* bg-slate-800 */
    color: #e2e8f0 !important; /* text-slate-200 */
    padding: 1.5rem !important;
    border-radius: 0.5rem !important;
}

#print-section h2, #print-section h3, #print-section-container h2 {
    color: #e2e8f0 !important; /* text-slate-200 */
    font-size: 1.5rem !important;
    margin-bottom: 1.25rem !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(203, 213, 225, 0.2) !important;
    padding-bottom: 0.5rem !important;
    text-align: center !important;
}

#results-content p, #print-section p {
    color: #f8fafc !important; /* text-slate-100 - máximo contraste */
    font-size: 1.1rem; /* Texto más grande */
    line-height: 1.6; /* Espaciado entre líneas mejorado */
    text-align: left; /* Alineación a la izquierda en lugar de justificado */
    margin-bottom: 1.25rem; /* Mayor espaciado inferior */
    font-weight: 500; /* Ligeramente más negrita para mejor legibilidad */
}

/* Mejora para el análisis de viabilidad específicamente */
.bg-slate-50 {
    background-color: #2d3a4e !important; /* Ligeramente más claro que slate-800 para contraste */
    border-radius: 0.5rem !important;
    padding: 1.5rem !important;
    margin-top: 1.5rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(203, 213, 225, 0.1) !important;
}

.bg-slate-50 p {
    color: #f8fafc !important; /* text-slate-100 */
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: left;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Títulos dentro del análisis de viabilidad */
.bg-slate-50 h3 {
    color: #93c5fd !important; /* text-blue-300 - más brillante */
    font-size: 1.4rem !important;
    margin-bottom: 1.25rem !important;
    font-weight: 700 !important;
    border-bottom: 1px solid rgba(96, 165, 250, 0.4) !important;
    padding-bottom: 0.5rem !important;
    letter-spacing: 0.015rem !important;
}

/* Valores destacados en la sección de viabilidad */
.bg-slate-50 .font-bold {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01rem !important;
}

/* Nota de recomendación del Banco de España - distinguir visualmente */
.bg-slate-50 p.text-xs {
    font-size: 0.9rem !important;
    font-style: italic;
    color: #94a3b8 !important; /* text-slate-400 */
    margin-top: 1rem;
    border-top: 1px solid rgba(203, 213, 225, 0.2);
    padding-top: 0.75rem;
}

/* Estilo para hacer más ancho el contenedor de resultados */
@media (min-width: 1024px) {
    .result-container {
        max-width: 1000px !important;
    }
    
    /* Layout de dos columnas para los resultados en escritorio */
    #step-5 {
        padding: 2rem !important;
    }
    
    #results-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    #results-content > div:first-child {
        grid-column: 1 / -1;
    }
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 240px; 
    background-color: #374151; /* gray-700 */
    color: #fff;
    text-align: left; 
    border-radius: 6px;
    padding: 10px; /* Más padding */
    position: absolute;
    z-index: 10;
    bottom: 130%; /* Un poco más arriba */
    left: 50%;
    margin-left: -120px; 
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    line-height: 1.4; /* Mejor interlineado */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Clases de colores para viabilidad */
.text-green-600 { color: #16A34A; }
.text-yellow-700 { color: #A16207; }
.text-orange-600 { color: #EA580C; }
.text-red-600 { color: #DC2626; }
.text-slate-500 { color: #64748B; }
.text-slate-800 { color: #1E293B; }
.text-blue-600 { color: #2563EB; }
.text-blue-700 { color: #1D4ED8; }

/* Estilos mínimos para impresión */
@media print {
    /* Ocultar lo que no se debe imprimir */
    .no-print, nav, button, #progress-container, footer, .btn, .shadow-lg, .rounded-lg {
        display: none !important;
    }
    
    /* Mostrar solo lo que debe imprimirse */
    .print-only, #print-section, #print-section * {
        display: block !important;
    }
    
    /* Colores básicos */
    body, html, * {
        background: white !important;
        color: black !important;
        font-size: 12pt !important;
    }
    
    /* Eliminar fondos y bordes */
    div, main, section, p, h1, h2, h3, h4, h5, h6 {
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    /* Configurar espaciado */
    h2, h3 {
        margin-top: 15px !important;
        margin-bottom: 10px !important;
    }
    
    p {
        margin-bottom: 5px !important;
    }
    
    /* Header con logo para impresión */
    .print-header {
        text-align: center;
        border-bottom: 1px solid #ddd !important;
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
    }
    
    /* Logo de impresión */
    .print-logo {
        text-align: center;
        font-size: 28pt;
        font-weight: bold;
        margin-bottom: 5px !important;
    }
    
    .print-logo .main {
        color: black !important;
        text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    }
    
    .print-logo .es {
        color: #2563eb !important;
    }
    body {
        background-color: white; /* Fondo blanco para imprimir */
    }
    body * {
        visibility: hidden;
        -webkit-print-color-adjust: exact !important; /* Fuerza colores en Chrome */
        color-adjust: exact !important; /* Fuerza colores estándar */
    }
    #print-section, #print-section * {
        visibility: visible;
    }
    #print-section {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 15px;
        font-size: 11px; 
    }
    #print-section h2, #print-section h3, #print-section h4 {
        margin-top: 8px;
        margin-bottom: 4px;
        font-size: 13px;
        color: black !important; /* Forzar negro para títulos */
    }
     #print-section h4 {
        font-size: 12px;
    }
    #print-section p, #print-section li {
        margin-bottom: 2px;
        font-size: 11px;
        color: black !important; /* Forzar negro para texto */
    }
    #print-section .btn {
        display: none; 
    }
    .no-print {
        display: none !important;
    }
    #print-section .grid { /* Forzar columnas a stack en print */
        display: block;
    }
    #print-section .grid > div {
        margin-bottom: 10px;
        border: 1px solid #ccc !important; /* Borde visible en impresión */
        background-color: white !important; /* Fondo blanco */
    }
    #print-section .bg-blue-50, 
    #print-section .bg-slate-50 {
        background-color: white !important;
    }
    #print-section span[class*="text-"] { /* Intentar mantener colores de viabilidad */
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
     /* Asegurar que los colores de viabilidad se impriman si es posible */
    #print-section .text-green-600 { color: #16A34A !important; }
    #print-section .text-yellow-700 { color: #A16207 !important; }
    #print-section .text-orange-600 { color: #EA580C !important; }
    #print-section .text-red-600 { color: #DC2626 !important; }
    #print-section .text-blue-600 { color: #2563EB !important; }
}