/* ============================================================
   SISTEMA DE VALORACIONES - ESTRELLAS (VERSIÓN ESPECTACULAR)
   Paleta de colores: #74132e (vino) y #ffb44f (dorado)
   ============================================================ */

/* Contenedor principal - Diseño tipo pergamino elegante */
.rating-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #fdf5e6 0%, #f9f3e8 100%);
    border-radius: 12px;
    border-left: 6px solid #ffb44f;
    box-shadow:
        0 8px 24px rgba(116, 19, 46, 0.12),
        inset 0 2px 4px rgba(184, 101, 26, 0.05);
    overflow: hidden;
}

/* Efecto de brillo sutil en el fondo */
.rating-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        #74132e 0%,
        #ffb44f 25%,
        #b8651a 50%,
        #ffb44f 75%,
        #74132e 100%);
    opacity: 0.6;
}

/* Resumen de valoraciones */
.rating-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(116, 19, 46, 0.15);
}

/* Número grande del promedio */
.rating-average {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: #74132e;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(116, 19, 46, 0.2);
    position: relative;
}

.rating-average::after {
    content: '/5';
    font-size: 1.5rem;
    color: #b8651a;
    opacity: 0.7;
    margin-left: 4px;
}

/* Estrellas de display (solo lectura) */
.rating-stars-display {
    display: flex;
    gap: 6px;
    flex-direction: row; /* Mostrar en fila horizontal */
}

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

/* Contador de valoraciones */
.rating-count {
    color: #74132e;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(116, 19, 46, 0.08);
    border-radius: 20px;
    display: inline-block;
}

/* Widget de valoración del usuario */
.rating-widget {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    border: 2px dashed rgba(184, 101, 26, 0.3);
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.rating-widget:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #ffb44f;
    box-shadow: 0 4px 12px rgba(255, 180, 79, 0.2);
}

/* Botón de confirmación de valoración */
.rating-submit-btn {
    padding: 12px 28px;
    background: linear-gradient(135deg, #74132e 0%, #8d1a3a 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 12px rgba(116, 19, 46, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    position: relative;
    overflow: hidden;
}

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

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

.rating-submit-btn:hover {
    background: linear-gradient(135deg, #8d1a3a 0%, #a52244 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(116, 19, 46, 0.4);
}

.rating-submit-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(116, 19, 46, 0.3);
}

.rating-submit-btn i {
    font-size: 1.2rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.rating-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.rating-submit-btn:disabled:hover {
    transform: none;
}

/* Label del widget */
.rating-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: #74132e;
    min-width: 120px;
}

/* Contenedor de estrellas interactivas */
.stars-input {
    display: flex;
    gap: 8px;
    direction: rtl; /* Para que el hover funcione de derecha a izquierda */
}

/* Estrellas base */
.star {
    font-size: 2.5rem;
    color: #ddd;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    position: relative;
}

/* Efecto hover y activo en estrellas */
.star:hover,
.star:hover ~ .star,
.star.active {
    color: #ffb44f;
    transform: scale(1.2) rotate(-10deg);
    filter: drop-shadow(0 4px 8px rgba(255, 180, 79, 0.5));
}

/* Estrellas llenas (votadas) */
.star.filled {
    color: #ffb44f;
    animation: starPulse 0.5s ease;
}

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

/* Efecto de brillo en las estrellas al hacer hover */
.star:not(.readonly):hover::after {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1rem;
    animation: sparkle 0.6s ease infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

/* Estrellas de solo lectura */
.star.readonly {
    cursor: default;
    font-size: 2rem;
}

.star.readonly:hover {
    transform: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.star.readonly:hover::after {
    display: none;
}

/* Feedback visual tras votar */
.rating-feedback {
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
    display: none;
    animation: slideDownFade 0.5s ease;
    font-weight: 500;
}

.rating-feedback.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
    display: block;
}

.rating-feedback.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
    display: block;
}

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

/* Mensaje para usuarios no autenticados */
.rating-login-required {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #74132e;
    background: linear-gradient(135deg, #fff3cd 0%, #ffedd5 100%);
    border: 2px solid #ffb44f;
    padding: 20px 25px;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(255, 180, 79, 0.2);
}

.rating-login-required i {
    font-size: 1.5rem;
    color: #b8651a;
}

.rating-login-required a {
    color: #74132e;
    font-weight: 700;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.rating-login-required a:hover {
    color: #b8651a;
    text-decoration: none;
}

/* Animación de carga */
.rating-loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(116, 19, 46, 0.2);
    border-top: 3px solid #74132e;
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
}

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

/* Tu valoración actual (mensaje) */
.your-rating {
    color: #74132e;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 10px;
    padding: 10px 15px;
    background: rgba(116, 19, 46, 0.08);
    border-radius: 20px;
    display: inline-block;
    animation: fadeInUp 0.5s ease;
}

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

.your-rating .stars {
    color: #ffb44f;
    font-weight: bold;
    font-size: 1.1rem;
    margin-left: 5px;
}

/* Estados de opacidad durante carga */
.rating-widget[style*="opacity: 0.5"] {
    pointer-events: none;
    opacity: 0.5 !important;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .rating-container {
        padding: 20px;
        gap: 15px;
    }

    .rating-average {
        font-size: 3rem;
    }

    .rating-summary {
        gap: 15px;
    }

    .star {
        font-size: 2rem;
    }

    .rating-widget {
        gap: 15px;
        padding: 15px;
    }

    .rating-label {
        font-size: 1.1rem;
    }
}

/* Responsive - Móvil */
@media (max-width: 576px) {
    .rating-container {
        padding: 15px;
        margin: 20px 0;
        gap: 12px;
    }

    .rating-average {
        font-size: 2.5rem;
    }

    .rating-average::after {
        font-size: 1.2rem;
    }

    .rating-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .star {
        font-size: 1.8rem;
    }

    .star.readonly {
        font-size: 1.5rem;
    }

    .stars-input {
        gap: 6px;
    }

    .rating-widget {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 15px;
    }

    .rating-label {
        min-width: auto;
        font-size: 1rem;
    }

    .rating-submit-btn {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        font-size: 1rem;
        padding: 10px 20px;
    }

    .rating-login-required {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .rating-feedback {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* Animación de entrada del contenedor */
@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rating-container {
    animation: containerFadeIn 0.6s ease;
}

/* Efecto hover en el contenedor completo */
.rating-container:hover {
    box-shadow:
        0 12px 32px rgba(116, 19, 46, 0.18),
        inset 0 2px 4px rgba(184, 101, 26, 0.08);
}
