/**
 * Sistema di Votazione Foto - CSS
 * Stili per l'interfaccia di voto con stelle
 */

/* Container principale */
.photo-rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    color: white;
}

.photo-rating:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Contenitore stelle */
.rating-stars {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Stelle base */
.star {
    color: #ccc;
    font-size: 20px;
    transition: all 0.2s ease;
    cursor: default;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.star i {
    display: block;
}

/* Stelle interattive */
.star-interactive {
    cursor: pointer;
    transform: scale(1);
    color: #ddd;
}

.star-interactive:hover {
    color: #ffed4e;
    transform: scale(1.1);
    text-shadow: 0 0 8px rgba(255, 237, 78, 0.6);
}

/* Stati delle stelle */
.star-filled {
    color: #ffd700;
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.star-partial {
    background: linear-gradient(90deg, #ffd700 50%, #ddd 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.star-hover {
    color: #ffed4e;
    transform: scale(1.1);
}

.star-selected {
    color: #ffd700;
    transform: scale(1.05);
    animation: starPulse 0.3s ease;
}

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

/* Dimensioni stelle */
.rating-small .star {
    font-size: 16px;
}

.rating-medium .star {
    font-size: 20px;
}

.rating-large .star {
    font-size: 28px;
}

/* Statistiche */
.rating-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.rating-average {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.rating-count {
    color: #888;
    font-size: 12px;
}

/* Azioni */
.rating-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-vote,
.btn-update-vote {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-vote:hover,
.btn-update-vote:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-vote:active,
.btn-update-vote:active {
    transform: translateY(0);
}

.btn-update-vote {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-update-vote:hover {
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* Messaggi */
.rating-message {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    min-height: 16px;
    transition: all 0.3s ease;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Modalità readonly */
.rating-readonly {
    background: transparent;
    box-shadow: none;
    padding: 4px;
}

.rating-readonly:hover {
    box-shadow: none;
}

.rating-readonly .star {
    cursor: default;
}

/* Layout responsive */
@media (max-width: 768px) {
    .photo-rating {
        padding: 8px;
        gap: 6px;
    }
    
    .rating-large .star {
        font-size: 24px;
    }
    
    .rating-medium .star {
        font-size: 18px;
    }
    
    .rating-small .star {
        font-size: 14px;
    }
    
    .btn-vote,
    .btn-update-vote {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Integrazione con galleria foto */
.photo-item .photo-rating {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    backdrop-filter: blur(4px);
}

.photo-item .photo-rating .rating-stats {
    color: #ccc;
}

.photo-item .photo-rating .rating-average {
    color: #fff;
}

/* Overlay per lightbox */
.lightbox .photo-rating {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lightbox .photo-rating .star {
    color: #666;
}

.lightbox .photo-rating .star-filled {
    color: #ffd700;
}

.lightbox .photo-rating .rating-stats {
    color: #ccc;
}

.lightbox .photo-rating .rating-average {
    color: #fff;
}

/* Animazioni di caricamento */
.rating-loading {
    opacity: 0.6;
    pointer-events: none;
}

.rating-loading .star {
    animation: starLoading 1.5s ease-in-out infinite;
}

@keyframes starLoading {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.rating-loading .star:nth-child(2) {
    animation-delay: 0.1s;
}

.rating-loading .star:nth-child(3) {
    animation-delay: 0.2s;
}

.rating-loading .star:nth-child(4) {
    animation-delay: 0.3s;
}

.rating-loading .star:nth-child(5) {
    animation-delay: 0.4s;
}

/* Tooltip per stelle */
.star[title] {
    position: relative;
}

.star[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.star[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

/* Accessibilità */
.photo-rating:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.star-interactive:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Tema scuro */
@media (prefers-color-scheme: dark) {
    .photo-rating {
        background: rgba(30, 30, 30, 0.95);
        color: #e0e0e0;
    }
    
    .rating-stats {
        color: #b0b0b0;
    }
    
    .rating-average {
        color: #e0e0e0;
    }
    
    .rating-count {
        color: #888;
    }
}

/* Print styles */
@media print {
    .photo-rating {
        background: white !important;
        box-shadow: none !important;
        color: black !important;
    }
    
    .rating-actions {
        display: none !important;
    }
    
    .star-interactive {
        cursor: default !important;
    }
}