/* ============================================
   SISTEMA DE CALIFICACIÓN MODERNO
   Consultores Belrey - Rating System v2.0
   ============================================ */

/* Variables CSS */
:root {
    --star-color-empty: #d1d5db;
    --star-color-filled: #fbbf24;
    --star-color-hover: #f59e0b;
    --star-color-selected: #f97316;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* Reset y Base */
.rating-container * {
    box-sizing: border-box;
}

/* Contenedor Principal */
.rating-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
}

.rating-header {
    text-align: center;
    margin-bottom: 2rem;
}

.rating-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.rating-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Avatar del Motorizado */
.motorizado-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.motorizado-avatar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.motorizado-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.motorizado-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.motorizado-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.motorizado-info .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sistema de Estrellas Moderno */
.stars-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 0.75rem;
}

.star-rating {
    display: flex;
    gap: 0.25rem;
    direction: rtl; /* Truco para el hover de derecha a izquierda */
}

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

.star-rating label {
    cursor: pointer;
    font-size: 2.5rem;
    color: var(--star-color-empty);
    transition: all var(--transition-fast);
    position: relative;
}

.star-rating label::before {
    content: '★';
    display: block;
    transform-origin: center;
    transition: transform var(--transition-normal), color var(--transition-fast);
}

/* Efecto hover y selección */
.star-rating label:hover::before,
.star-rating label:hover ~ label::before {
    color: var(--star-color-hover);
    transform: scale(1.2);
}

.star-rating input[type="radio"]:checked ~ label::before {
    color: var(--star-color-filled);
}

.star-rating input[type="radio"]:checked + label::before {
    color: var(--star-color-selected);
    transform: scale(1.15);
}

/* Animación de selección */
@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.star-rating input[type="radio"]:checked + label::before {
    animation: starPulse 0.4s ease;
}

/* Texto de calificación */
.rating-text {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    min-height: 2rem;
    transition: all var(--transition-normal);
    margin-bottom: 1rem;
}

.rating-text.excellent { color: #10b981; }
.rating-text.good { color: #3b82f6; }
.rating-text.average { color: #f59e0b; }
.rating-text.poor { color: #f97316; }
.rating-text.bad { color: #ef4444; }

/* Indicador de puntuación */
.rating-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.rating-score .score-value {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--star-color-filled), var(--star-color-selected));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rating-score .score-max {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Campo de comentarios */
.comment-section {
    margin-top: 1.5rem;
}

.comment-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.comment-section textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.comment-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-section textarea::placeholder {
    color: var(--text-muted);
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Categorías de mejora */
.improvement-tags {
    margin: 1.5rem 0;
}

.improvement-tags h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 9999px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tag-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tag-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tag-btn input {
    display: none;
}

/* Botón de envío */
.submit-section {
    margin-top: 2rem;
}

.btn-submit {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-submit .btn-icon {
    margin-right: 0.5rem;
}

/* Estado de carga */
.btn-submit.loading {
    pointer-events: none;
}

.btn-submit.loading .btn-text {
    visibility: hidden;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -12px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mensaje de éxito */
.success-message {
    display: none;
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 0.5s ease;
}

.success-message.show {
    display: block;
}

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

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--success-color), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    animation: scaleIn 0.5s ease;
}

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

.success-message h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.success-message p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Alertas */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

.alert-icon {
    font-size: 1.25rem;
}

/* Info del pedido */
.order-info {
    background: var(--bg-light);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.order-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.order-info-item:last-child {
    border-bottom: none;
}

.order-info-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.order-info-item .value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Responsive */
@media (max-width: 640px) {
    .rating-container {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: 0.75rem;
    }

    .star-rating label {
        font-size: 2rem;
    }

    .rating-score .score-value {
        font-size: 2.5rem;
    }

    .motorizado-avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* Animaciones adicionales */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

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

/* Tema oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    .rating-container.dark-mode {
        --text-color: #f9fafb;
        --text-muted: #9ca3af;
        --bg-light: #374151;
        --bg-card: #1f2937;
        --border-color: #4b5563;
    }
}

/* Estrellas con iconos de fuente */
.star-icon {
    font-family: 'FontAwesome', sans-serif;
}

.star-icon.empty::before {
    content: '\f006';
}

.star-icon.filled::before {
    content: '\f005';
}

.star-icon.half::before {
    content: '\f123';
}

/* Efecto de brillo en las estrellas */
.star-glow {
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
}

/* Progress bar para NPS */
.nps-indicator {
    margin: 1rem 0;
}

.nps-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

.nps-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color), var(--warning-color), var(--success-color));
    border-radius: 9999px;
    transition: width var(--transition-slow);
}

.nps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Tooltip */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-color);
    color: white;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 10;
}

.tooltip-wrapper:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-light) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
