/**
 * Estilos para Calculadora de Alquileres
 * Version: 2.0.1 - Mejorado
 * Estética v1 + Fixes de espacios blancos v2
 */

/* RESET CRÍTICO - Evitar espacios blancos (desde v2) */
.calculadora-alquileres-container {
    max-width: 100% !important;
    width: 100% !important;
    height: 100$ !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: transparent;
    box-sizing: border-box;
}

/* Contenedor interno con ancho controlado y estética v1 */
.calculadora-alquileres-container .paso-form {
    max-width: 1200px;
    margin: 40px auto !important;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.paso-form h2 {
    font-size: 28px;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.form-divider {
    width: 60px;
    height: 4px;
    background: #AD8142;
    margin-bottom: 20px;
    border-radius: 2px;
}

.descripcion {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 15px;
}

/* Filas y grupos de formulario */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 250px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.col-12 {
    flex: 0 0 100%;
}

.form-group.col-md-6 {
    flex: 0 0 calc(50% - 7.5px);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.required {
    color: #AD8142;
}

/* Inputs y controles */
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #AD8142;
    box-shadow: 0 0 0 3px rgba(228, 45, 36, 0.1);
    background: #fff;
}

.form-control::placeholder {
    color: #999;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Selector de índices */
.index-selector {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.index-box {
    flex: 1;
    padding: 20px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
    background: #fff;
}

.index-box:hover {
    border-color: #AD8142;
    background: #fff5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.index-box.selected {
    border-color: #AD8142;
    background: #AD8142;
    color: #fff;
}

/* Botones */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #AD8142;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #AD8142;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 115, 190, 0.3);
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-continuar, .btn-calcular {
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 30px auto 0;
}

/* Contenedor de resultados */
.resultado-container {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    display: none;
    border-left: 4px solid #AD8142;
}

.resultado-container.show {
    display: block !important;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.valor-final {
    font-size: 36px;
    font-weight: 700;
    color: #AD8142;
    margin: 10px 0;
    text-align: center;
}

.valor-proximo {
    font-size: 24px;
    font-weight: 600;
    color: #28a745;
    white-space: nowrap;
}

/* Tabla de resultados */
.tabla-container {
    margin-top: 30px;
    overflow-x: auto;
    display: none;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tabla-container table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tabla-container th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    color: #495057;
}

.tabla-container td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
}

.tabla-container tbody tr:hover {
    background: #f8f9fa;
}

/* Colores de fondo para filas */
.bg-lime {
    background-color: #d4edda !important;
    border-left: 3px solid #28a745;
}

.bg-yellow {
    background-color: #fff3cd !important;
    border-left: 3px solid #ffc107;
}

.bg-gray-200 {
    background-color: #e9ecef !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    margin-right: 5px;
    font-weight: 500;
}

.bg-red-lt {
    background: #ffe0e0;
    color: #AD8142;
}

.bg-blue-lt {
    background: #d0ebff;
    color: #AD8142;
}

.bg-default-lt {
    background: #e9ecef;
    color: #495057;
}

/* Mensajes de error */
.error {
    color: #e42d24;
    font-weight: 500;
    padding: 10px;
    background: #ffe0e0;
    border-radius: 4px;
    border-left: 3px solid #e42d24;
}

/* Listado de Leads */
.listado-leads-container {
    padding: 20px;
}

.listado-leads-container h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.filtros-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filtros-container .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

/* DataTables personalización */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 15px;
}

/* Alertas */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive */
@media (max-width: 768px) {
    .calculadora-alquileres-container .paso-form {
        margin: 20px 15px !important;
        padding: 20px;
    }
    
    .paso-form h2 {
        font-size: 24px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group,
    .form-group.col-md-6 {
        flex: 0 0 100%;
        width: 100%;
        min-width: 100%;
    }
    
    .index-selector {
        flex-direction: column;
    }
    
    .index-box {
        width: 100%;
    }
    
    .valor-final {
        font-size: 28px;
    }
    
    .valor-proximo {
        font-size: 20px;
    }
    
    .tabla-container {
        font-size: 12px;
    }
    
    .tabla-container th,
    .tabla-container td {
        padding: 8px;
    }
    
    .btn-continuar, .btn-calcular {
        max-width: 100%;
    }
    
    .filtros-container .form-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .paso-form h2 {
        font-size: 20px;
    }
    
    .valor-final {
        font-size: 24px;
    }
    
    .badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Animaciones de carga */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mejoras de accesibilidad */
.form-control:focus-visible,
.btn:focus-visible,
.index-box:focus-visible {
    outline: 2px solid #1e73be;
    outline-offset: 2px;
}

/* Fix para temas de WordPress que añaden márgenes (desde v2) */
.calculadora-alquileres-container * {
    box-sizing: border-box;
}

.calculadora-alquileres-container p {
    margin: 0 0 15px 0;
}

.calculadora-alquileres-container h1,
.calculadora-alquileres-container h2,
.calculadora-alquileres-container h3 {
    margin-top: 0;
}

/* Eliminar espacios que WordPress agrega automáticamente (desde v2) */
.calculadora-alquileres-container br {
    display: none;
}

/* Reset de márgenes para evitar espacios blancos (desde v2) */
body .calculadora-alquileres-container {
    margin: 0 !important;
    padding: 0 !important;
}

/* Si el shortcode está dentro de un entry-content u otro contenedor (desde v2) */
.entry-content .calculadora-alquileres-container,
.site-content .calculadora-alquileres-container,
.page-content .calculadora-alquileres-container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Eliminar padding superior e inferior que WordPress agrega (desde v2) */
.entry-content > .calculadora-alquileres-container:first-child,
.site-content > .calculadora-alquileres-container:first-child,
.page-content > .calculadora-alquileres-container:first-child {
    margin-top: -40px !important;
}

.entry-content > .calculadora-alquileres-container:last-child,
.site-content > .calculadora-alquileres-container:last-child,
.page-content > .calculadora-alquileres-container:last-child {
    margin-bottom: -40px !important;
}

/* Print styles */
@media print {
    .btn,
    .filtros-container {
        display: none;
    }
    
    .paso-form {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
