/* SEO Reviews Simple v3.0 - Frontend Minimalista CORREGIDO */

/* ===== VARIABLES MINIMALISTAS ===== */
:root {
    /* Colores principales - tonos suaves */
    --asr-primary: #6366f1;
    --asr-primary-light: #a5b4fc;
    --asr-primary-bg: #f0f4ff;
    
    /* Colores neutros - grises cálidos */
    --asr-text-primary: #374151;
    --asr-text-secondary: #6b7280;
    --asr-text-light: #9ca3af;
    
    /* Fondos minimalistas */
    --asr-bg-white: #ffffff;
    --asr-bg-light: #f9fafb;
    --asr-bg-card: #ffffff;
    
    /* Bordes suaves */
    --asr-border-light: #e5e7eb;
    --asr-border-medium: #d1d5db;
    
    /* Colores de estado - versiones suaves */
    --asr-success: #10b981;
    --asr-success-light: #d1fae5;
    --asr-warning: #f59e0b;
    --asr-warning-light: #fef3c7;
    --asr-danger: #ef4444;
    --asr-danger-light: #fee2e2;
    
    /* Estrellas - MANTIENE EL DORADO QUE TE GUSTA */
    --asr-star-color: #ffb400;
    --asr-star-empty: #e5e7eb;
    
    /* Efectos suaves */
    --asr-shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --asr-shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.06);
    --asr-radius-small: 6px;
    --asr-radius-medium: 8px;
    --asr-radius-large: 12px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.asr-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--asr-text-primary);
}

/* ===== RESUMEN DE CALIFICACIONES ===== */
.asr-summary {
    background: var(--asr-bg-white);
    border: 1px solid var(--asr-border-light);
    border-radius: var(--asr-radius-large);
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: var(--asr-shadow-soft);
}

.asr-summary.asr-no-rating {
    text-align: center;
    background: var(--asr-bg-light);
    border-style: dashed;
}

.asr-no-reviews-text {
    margin: 0;
    color: var(--asr-text-secondary);
    font-style: italic;
    font-size: 15px;
}

.asr-summary.asr-has-reviews .asr-summary-main {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}

.asr-rating-number {
    text-align: center;
}

.asr-avg-rating {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--asr-primary);
    display: block;
    line-height: 1;
}

.asr-max-rating {
    font-size: 1.1rem;
    color: var(--asr-text-secondary);
    font-weight: 400;
}

.asr-stars-container {
    text-align: center;
}

.asr-stars {
    font-size: 22px;
    margin-bottom: 8px;
}

.asr-review-count {
    font-size: 14px;
    color: var(--asr-text-secondary);
    font-weight: 500;
}

/* ===== DISTRIBUCIÓN DE RATINGS ===== */
.asr-rating-breakdown {
    display: grid;
    gap: 10px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--asr-border-light);
}

.asr-rating-bar {
    display: grid;
    grid-template-columns: 40px 1fr 35px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.asr-rating-label {
    color: var(--asr-text-secondary);
    font-weight: 500;
}

.asr-bar-container {
    height: 6px;
    background: var(--asr-star-empty);
    border-radius: 3px;
    overflow: hidden;
}

.asr-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--asr-star-color) 0%, #ffa000 100%);
    transition: width 0.8s ease;
    border-radius: 3px;
}

.asr-rating-count {
    text-align: right;
    color: var(--asr-text-light);
    font-size: 12px;
    font-weight: 500;
}

/* ===== ESTRELLAS MINIMALISTAS ===== */
.asr-star, .asr-star-small {
    color: var(--asr-star-empty);
    transition: all 0.3s ease;
}

.asr-star {
    font-size: 22px;
    margin-right: 3px;
}

.asr-star-small {
    font-size: 16px;
    margin-right: 2px;
}

.asr-star-full, .asr-star-half {
    color: var(--asr-star-color);
    text-shadow: 0 1px 3px rgba(255, 180, 0, 0.2);
}

/* ===== FORMULARIO MINIMALISTA ===== */
.asr-form-section {
    background: var(--asr-bg-white);
    border: 1px solid var(--asr-border-light);
    border-radius: var(--asr-radius-large);
    padding: 32px;
    margin-bottom: 30px;
    box-shadow: var(--asr-shadow-soft);
}

.asr-form-title {
    margin: 0 0 28px 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--asr-text-primary);
    border-bottom: 2px solid var(--asr-primary);
    padding-bottom: 12px;
}

.asr-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.asr-field {
    margin-bottom: 24px;
}

.asr-field-half {
    margin-bottom: 0;
}

.asr-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--asr-text-primary);
    font-size: 14px;
}

.asr-field input[type="text"],
.asr-field input[type="email"],
.asr-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--asr-border-light);
    border-radius: var(--asr-radius-small);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--asr-bg-white);
    color: var(--asr-text-primary);
}

.asr-field input[type="text"]:focus,
.asr-field input[type="email"]:focus,
.asr-field textarea:focus {
    outline: none;
    border-color: var(--asr-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.asr-field-note {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--asr-text-light);
}

/* ===== RATING SYSTEM COMPLETAMENTE CORREGIDO ===== */
.asr-rating-input {
    display: flex !important;
    flex-direction: row-reverse !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    margin: 12px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.asr-rating-input input[type="radio"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.asr-rating-input .asr-star-label {
    font-size: 2rem !important;
    color: #e5e7eb !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    user-select: none !important;
    padding: 4px !important;
    margin: 0 !important;
    display: inline-block !important;
    position: relative !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
}

.asr-rating-input .asr-star-label:hover,
.asr-rating-input .asr-star-label:hover ~ .asr-star-label {
    color: #ffb400 !important;
    transform: scale(1.1) !important;
    text-shadow: 0 2px 4px rgba(255, 180, 0, 0.3) !important;
}

.asr-rating-input .asr-star-label:focus {
    outline: 2px solid var(--asr-primary) !important;
    outline-offset: 2px !important;
}

.asr-rating-input input[type="radio"]:checked ~ .asr-star-label {
    color: #ffb400 !important;
    transform: scale(1.05) !important;
    text-shadow: 0 2px 4px rgba(255, 180, 0, 0.3) !important;
}

.asr-rating-text {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #667eea !important;
    min-height: 24px !important;
    margin-top: 8px !important;
    transition: all 0.3s ease !important;
    display: block !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.asr-rating-text.asr-rating-selected {
    color: #667eea !important;
    font-weight: 600 !important;
}

/* ===== CONTADOR DE CARACTERES ===== */
.asr-char-count {
    text-align: right;
    font-size: 12px;
    color: var(--asr-text-light);
    margin-top: 6px;
}

.asr-current-chars {
    font-weight: 600;
}

.asr-char-count.asr-valid .asr-current-chars {
    color: var(--asr-success);
}

.asr-char-count.asr-invalid .asr-current-chars {
    color: var(--asr-danger);
}

/* ===== BOTONES MINIMALISTAS ===== */
.asr-form-actions {
    margin-top: 28px;
    text-align: center;
}

.asr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--asr-border-light);
    border-radius: var(--asr-radius-small);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 140px;
    position: relative;
    background: var(--asr-bg-white);
    color: var(--asr-text-primary);
}

.asr-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--asr-shadow-medium);
}

.asr-btn-primary {
    background: linear-gradient(135deg, var(--asr-primary) 0%, var(--asr-primary-light) 100%);
    color: white;
    border-color: var(--asr-primary);
}

.asr-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.asr-btn:disabled {
    background: var(--asr-bg-light);
    color: var(--asr-text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: var(--asr-border-light);
}

/* ===== MENSAJES SUAVES ===== */
.asr-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--asr-radius-small);
    font-weight: 500;
    border: 1px solid;
    animation: fadeIn 0.4s ease;
}

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

.asr-message.asr-success {
    background: var(--asr-success-light);
    color: var(--asr-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.asr-message.asr-error {
    background: var(--asr-danger-light);
    color: var(--asr-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ===== LISTA DE REVIEWS SUAVE ===== */
.asr-reviews-section {
    margin-top: 40px;
}

.asr-reviews-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--asr-text-primary);
    margin-bottom: 24px;
    border-bottom: 2px solid var(--asr-primary);
    padding-bottom: 12px;
}

.asr-reviews-list {
    display: grid;
    gap: 20px;
}

.asr-review {
    background: var(--asr-bg-white);
    border: 1px solid var(--asr-border-light);
    border-radius: var(--asr-radius-large);
    padding: 24px;
    box-shadow: var(--asr-shadow-soft);
    transition: all 0.3s ease;
}

.asr-review:hover {
    box-shadow: var(--asr-shadow-medium);
    border-color: var(--asr-border-medium);
    transform: translateY(-1px);
}

.asr-review-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.asr-reviewer-info {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
}

.asr-reviewer-avatar {
    flex-shrink: 0;
}

.asr-reviewer-avatar img,
.asr-avatar-fallback {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.asr-avatar-fallback {
    background: linear-gradient(135deg, var(--asr-primary) 0%, var(--asr-primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.asr-reviewer-details {
    flex: 1;
    min-width: 0;
}

.asr-reviewer-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--asr-text-primary);
    margin-bottom: 6px;
    display: block;
}

.asr-review-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--asr-text-secondary);
}

.asr-review-date {
    color: var(--asr-text-light);
}

.asr-verified-badge {
    background: var(--asr-success);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.asr-review-content {
    margin-bottom: 16px;
}

.asr-review-text {
    color: var(--asr-text-primary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ===== RESPUESTA DEL NEGOCIO SUAVE ===== */
.asr-business-response {
    background: var(--asr-primary-bg);
    border-left: 3px solid var(--asr-primary);
    padding: 16px;
    border-radius: var(--asr-radius-medium);
    margin-top: 12px;
}

.asr-response-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.asr-business-badge {
    background: var(--asr-primary);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.asr-response-text {
    color: var(--asr-text-primary);
    line-height: 1.5;
    margin-bottom: 8px;
    font-size: 14px;
}

.asr-response-date {
    font-size: 12px;
    color: var(--asr-text-light);
}

/* ===== ACCIONES SUAVES ===== */
.asr-review-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--asr-border-light);
}

.asr-helpful-btn {
    background: var(--asr-bg-light);
    border: 1px solid var(--asr-border-light);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--asr-text-secondary);
    transition: all 0.3s ease;
}

.asr-helpful-btn:hover {
    background: var(--asr-primary-bg);
    border-color: var(--asr-primary);
    color: var(--asr-primary);
}

/* ===== RESPONSIVE MINIMALISTA ===== */
@media (max-width: 768px) {
    .asr-container {
        margin: 16px 0;
    }
    
    .asr-form-section,
    .asr-summary {
        padding: 24px 20px;
        margin-bottom: 24px;
    }
    
    .asr-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .asr-field-half {
        margin-bottom: 24px;
    }
    
    .asr-summary.asr-has-reviews .asr-summary-main {
        flex-direction: column;
        gap: 20px;
    }
    
    .asr-avg-rating {
        font-size: 2.2rem;
    }
    
    .asr-rating-bar {
        grid-template-columns: 35px 1fr 30px;
        gap: 10px;
    }
    
    .asr-review {
        padding: 20px;
    }
    
    .asr-reviewer-info {
        gap: 12px;
    }
    
    .asr-review-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .asr-btn {
        width: 100%;
    }
    
    .asr-rating-input .asr-star-label {
        font-size: 1.75rem !important;
        padding: 6px !important;
    }
}

@media (max-width: 480px) {
    .asr-rating-input {
        justify-content: center;
    }
    
    .asr-rating-input .asr-star-label {
        font-size: 1.5rem !important;
        padding: 4px !important;
    }
    
    .asr-stars {
        font-size: 20px;
    }
    
    .asr-form-section,
    .asr-summary {
        padding: 20px 16px;
    }
}

/* ===== ANIMACIONES SUAVES ===== */
.asr-review {
    animation: slideInUp 0.5s ease forwards;
}

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

.asr-rating-input .asr-star-label:active {
    transform: scale(1.15) !important;
}

.asr-star-selected {
    animation: starPulse 0.3s ease;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ===== UTILIDADES ===== */
.asr-text-center { text-align: center; }
.asr-text-left { text-align: left; }
.asr-text-right { text-align: right; }
.asr-mb-0 { margin-bottom: 0; }
.asr-mt-0 { margin-top: 0; }
.asr-hidden { display: none; }
.asr-visible { display: block; }

/* ===== ESTADOS ADICIONALES ===== */
.asr-field-error input,
.asr-field-error textarea {
    border-color: var(--asr-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.asr-field-error-text {
    color: var(--asr-danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.asr-helpful-clicked {
    background: var(--asr-success) !important;
    color: white !important;
    border-color: var(--asr-success) !important;
}
// === RATING SYSTEM CORREGIDO COMPLETO ===
document.addEventListener('DOMContentLoaded', function() {
    console.log('🌟 Inicializando sistema de rating corregido');
    
    // TEXTOS CORREGIDOS SIN CORRUPCIÓN
    const RATING_TEXTS = {
        1: '😞 Muy malo',
        2: '😕 Malo', 
        3: '🙂 Regular',
        4: '😊 Bueno',
        5: '🤩 Excelente'
    };
    
    // Buscar todos los contenedores de rating
    const ratingContainers = document.querySelectorAll('.asr-rating-input');
    
    ratingContainers.forEach(function(container) {
        const radioInputs = container.querySelectorAll('input[type="radio"]');
        const labels = container.querySelectorAll('.asr-star-label');
        const textElement = container.parentNode.querySelector('.asr-rating-text');
        
        console.log('📝 Configurando container con', labels.length, 'estrellas');
        
        // Configurar eventos para cada label
        labels.forEach(function(label, index) {
            const input = label.previousElementSibling;
            const rating = parseInt(input.value);
            
            // HOVER EVENT
            label.addEventListener('mouseenter', function() {
                console.log('🌟 HOVER en estrella', rating);
                
                // Actualizar texto
                if (textElement) {
                    textElement.textContent = RATING_TEXTS[rating];
                    textElement.style.color = '#6366f1';
                    textElement.style.fontWeight = '600';
                }
                
                // Iluminar estrellas
                labels.forEach(function(star) {
                    const starRating = parseInt(star.previousElementSibling.value);
                    if (starRating <= rating) {
                        star.style.color = '#fbbf24';
                        star.style.transform = 'scale(1.15)';
                        star.style.filter = 'drop-shadow(0 2px 4px rgba(251, 191, 36, 0.4))';
                    } else {
                        star.style.color = '#d1d5db';
                        star.style.transform = 'scale(1)';
                        star.style.filter = 'none';
                    }
                });
            });
            
            // CLICK EVENT
            input.addEventListener('change', function() {
                console.log('✅ CLICK en estrella', rating);
                
                if (textElement) {
                    textElement.textContent = RATING_TEXTS[rating];
                    textElement.style.color = '#6366f1';
                    textElement.style.fontWeight = '600';
                }
                
                // Mantener estrellas iluminadas
                updateStarsDisplay(labels, rating);
            });
        });
        
        // LEAVE EVENT del contenedor
        container.addEventListener('mouseleave', function() {
            console.log('👋 LEAVE del contenedor');
            
            const checkedInput = container.querySelector('input[type="radio"]:checked');
            
            if (checkedInput) {
                const selectedRating = parseInt(checkedInput.value);
                if (textElement) {
                    textElement.textContent = RATING_TEXTS[selectedRating];
                }
                updateStarsDisplay(labels, selectedRating);
            } else {
                if (textElement) {
                    textElement.textContent = 'Selecciona tu calificacion';
                    textElement.style.color = '#6b7280';
                    textElement.style.fontWeight = '500';
                }
                resetStars(labels);
            }
        });
    });
    
    // Función para actualizar estrellas
    function updateStarsDisplay(labels, rating) {
        labels.forEach(function(star) {
            const starRating = parseInt(star.previousElementSibling.value);
            if (starRating <= rating) {
                star.style.color = '#fbbf24';
                star.style.transform = 'scale(1.05)';
                star.style.filter = 'drop-shadow(0 2px 4px rgba(251, 191, 36, 0.4))';
            } else {
                star.style.color = '#d1d5db';
                star.style.transform = 'scale(1)';
                star.style.filter = 'none';
            }
        });
    }
    
    // Función para resetear estrellas
    function resetStars(labels) {
        labels.forEach(function(star) {
            star.style.color = '#d1d5db';
            star.style.transform = 'scale(1)';
            star.style.filter = 'none';
        });
    }
    
    console.log('✅ Sistema de rating inicializado correctamente');
});
/* === RATING SYSTEM - VERSION FINAL === */
.asr-rating-input {
    display: flex !important;
    flex-direction: row-reverse !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    margin: 12px 0 !important;
    padding: 0 !important;
}

.asr-rating-input input[type="radio"] {
    display: none !important;
}

.asr-rating-input .asr-star-label {
    font-size: 2rem !important;
    color: #e5e7eb !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    user-select: none !important;
    padding: 4px !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.asr-rating-input .asr-star-label:hover,
.asr-rating-input .asr-star-label:hover ~ .asr-star-label {
    color: #fbbf24 !important;
    transform: scale(1.1) !important;
}

.asr-rating-input input[type="radio"]:checked ~ .asr-star-label {
    color: #fbbf24 !important;
}

.asr-rating-text {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #667eea !important;
    margin-top: 8px !important;
    min-height: 24px !important;
}