/* 
Comparador Electricidad España - CSS
Versión: 2.0
Incluye estilos para Factor Energía
*/

/* Fuente principal */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Variables CSS */
:root {
    --ce-primary-color: #3498db;
    --ce-secondary-color: #2c3e50;
    --ce-success-color: #27ae60;
    --ce-warning-color: #f39c12;
    --ce-danger-color: #e74c3c;
    --ce-light-color: #ecf0f1;
    --ce-dark-color: #34495e;
    --ce-factor-energia-color: #00a651;
    --ce-border-radius: 10px;
    --ce-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --ce-transition: all 0.3s ease;
}

/* Container principal */
.comparador-electricidad-widget {
    margin: 20px 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: white;
    border-radius: var(--ce-border-radius);
    box-shadow: var(--ce-shadow);
    overflow: hidden;
    max-width: 100%;
}

/* Header del widget */
.widget-header {
    background: linear-gradient(135deg, var(--ce-primary-color) 0%, var(--ce-secondary-color) 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.widget-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.widget-subtitle {
    font-size: 16px;
    margin: 0 0 20px 0;
    opacity: 0.9;
    line-height: 1.5;
}

.features-badges {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.badge-success {
    background: var(--ce-success-color);
    border-color: var(--ce-success-color);
}

/* Contenido principal */
.comparador-content {
    padding: 0;
}

/* Filtros */
.filtros-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filtro-grupo label {
    font-weight: 600;
    color: var(--ce-secondary-color);
    font-size: 14px;
}

.filtro-select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: var(--ce-transition);
    cursor: pointer;
}

.filtro-select:focus {
    outline: none;
    border-color: var(--ce-primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.factor-energia-option {
    background: linear-gradient(90deg, var(--ce-factor-energia-color) 0%, #00d084 100%);
    color: white;
    font-weight: 600;
}

/* Resultados */
.resultados-container {
    padding: 25px;
    min-height: 200px;
}

.loading-spinner {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--ce-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--ce-dark-color);
    font-size: 16px;
    margin: 0;
}

/* Iframe container */
.iframe-container {
    width: 100%;
    background: white;
    border-top: 1px solid #e9ecef;
}

.comparador-iframe {
    width: 100%;
    border: none;
    display: block;
}

/* Footer del widget */
.widget-footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.footer-text {
    margin: 0;
    font-size: 14px;
    color: var(--ce-dark-color);
    line-height: 1.5;
}

/* Widget de estadísticas */
.estadisticas-widget {
    background: white;
    padding: 25px;
    border-radius: var(--ce-border-radius);
    box-shadow: var(--ce-shadow);
    margin: 20px 0;
}

.stats-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--ce-secondary-color);
    margin: 0 0 20px 0;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: var(--ce-transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-item.stat-factor-energia {
    background: linear-gradient(135deg, var(--ce-factor-energia-color) 0%, #00d084 100%);
    color: white;
}

.stat-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.8;
    margin-top: 4px;
}

.stats-highlight {
    text-align: center;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 8px;
    border-left: 4px solid var(--ce-success-color);
}

.stats-highlight p {
    margin: 0;
    font-size: 14px;
    color: var(--ce-secondary-color);
}

/* Widget Factor Energía */
.factor-energia-widget {
    background: white;
    border-radius: var(--ce-border-radius);
    box-shadow: var(--ce-shadow);
    overflow: hidden;
    margin: 20px 0;
}

.fe-header {
    background: linear-gradient(135deg, var(--ce-factor-energia-color) 0%, #00d084 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

.fe-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.fe-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.fe-subtitle {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

.fe-stats {
    display: flex;
    justify-content: space-around;
    padding: 25px;
    background: #f8f9fa;
}

.fe-stat {
    text-align: center;
}

.fe-stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--ce-factor-energia-color);
    line-height: 1;
}

.fe-stat-label {
    display: block;
    font-size: 14px;
    color: var(--ce-dark-color);
    margin-top: 4px;
}

.fe-tarifas {
    padding: 25px;
}

.fe-tarifas h4 {
    margin: 0 0 15px 0;
    color: var(--ce-secondary-color);
}

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

.tarifa-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    background: white;
    transition: var(--ce-transition);
}

.tarifa-card:hover {
    border-color: var(--ce-factor-energia-color);
    transform: translateY(-2px);
}

.tarifa-card h5 {
    margin: 0 0 10px 0;
    color: var(--ce-secondary-color);
    font-weight: 600;
}

.tarifa-card .precio {
    font-size: 18px;
    font-weight: 700;
    color: var(--ce-factor-energia-color);
    margin: 8px 0;
}

.tarifa-card .descuento {
    display: inline-block;
    background: #e8f5e8;
    color: var(--ce-success-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
}

.tarifa-card .tipo {
    display: inline-block;
    background: #f0f8ff;
    color: var(--ce-primary-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.fe-features {
    padding: 0 25px 25px;
}

.fe-features h4 {
    margin: 0 0 15px 0;
    color: var(--ce-secondary-color);
}

.fe-features ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.fe-features li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.fe-features li:last-child {
    border-bottom: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .widget-title {
        font-size: 24px;
    }
    
    .filtros-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .features-badges {
        gap: 8px;
    }
    
    .badge {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .stat-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px;
    }
    
    .fe-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .tarifas-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .widget-header {
        padding: 20px 15px;
    }
    
    .widget-title {
        font-size: 20px;
    }
    
    .widget-subtitle {
        font-size: 14px;
    }
    
    .filtros-container {
        padding: 15px;
    }
    
    .resultados-container {
        padding: 15px;
    }
    
    .estadisticas-widget {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fe-header {
        padding: 20px 15px;
    }
    
    .fe-title {
        font-size: 20px;
    }
}

/* Animaciones */
.comparador-electricidad-widget {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Estados hover mejorados */
.stat-item:hover .stat-icon {
    transform: scale(1.1);
    transition: var(--ce-transition);
}

.tarifa-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Print styles */
@media print {
    .comparador-electricidad-widget {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .widget-header {
        background: var(--ce-secondary-color) !important;
        -webkit-print-color-adjust: exact;
    }
}