/**
 * Stili per il plugin Gestione Attestati con Liberatorie
 * Version: 1.0.0
 */

/* Container principale */
.attestati-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Intro */
.attestati-intro {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.attestati-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.attestati-intro p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
}

/* Form */
.attestati-form {
    margin-top: 20px;
}

.attestati-field {
    margin-bottom: 20px;
}

.attestati-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.attestati-field input[type="text"],
.attestati-field input[type="email"],
.attestati-field input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.attestati-field input:focus {
    outline: none;
    border-color: #667eea;
}

/* Info utente loggato */
.attestati-user-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.attestati-user-info p {
    margin: 5px 0;
    color: #555;
}

/* Checkbox consensi */
.attestati-consents {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    border-left: 4px solid #667eea;
}

.attestati-consent-item {
    margin-bottom: 15px;
}

.attestati-consent-item:last-child {
    margin-bottom: 0;
}

.attestati-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    line-height: 1.6;
}

.attestati-checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.consent-text {
    flex: 1;
    color: #333;
    font-size: 14px;
}

.consent-text a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.consent-text a:hover {
    color: #764ba2;
}

/* Bottone submit */
.attestati-submit {
    text-align: center;
    margin-top: 30px;
}

.attestati-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.attestati-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.attestati-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.attestati-button:active:not(:disabled) {
    transform: translateY(0);
}

/* Messaggi */
.attestati-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

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

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

/* Error message */
.attestati-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

.attestati-error a {
    color: #856404;
    text-decoration: underline;
    font-weight: 600;
}

/* Loading state */
.attestati-button.loading {
    position: relative;
    color: transparent;
}

.attestati-button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .attestati-container {
        padding: 20px;
        margin: 15px;
    }
    
    .attestati-intro {
        padding: 15px;
    }
    
    .attestati-icon {
        font-size: 36px;
    }
    
    .attestati-button {
        width: 100%;
        padding: 15px 20px;
    }
}

/* Print styles */
@media print {
    .attestati-button,
    .attestati-submit {
        display: none;
    }
}

/* ============================================
   STILI SONDAGGIO DI GRADIMENTO
   ============================================ */

.attestati-survey {
    background: #f0f7ff;
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    border-left: 5px solid #667eea;
}

.survey-title {
    color: #667eea;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.survey-intro {
    color: #555;
    font-size: 14px;
    margin: 0 0 20px 0;
}

.survey-question {
    margin-bottom: 25px;
}

.survey-question:last-child {
    margin-bottom: 0;
}

.survey-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 15px;
}

/* Stile emoji rating */
.emoji-rating {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.emoji-option {
    flex: 1;
    min-width: 110px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.emoji-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.emoji-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* IMPORTANTE: Stili quando selezionato - VERSIONE FORTE */
.emoji-option input[type="radio"]:checked + .emoji,
.emoji-option:has(input[type="radio"]:checked) {
    border-color: #667eea !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* CRITICO: Testo BIANCO quando selezionato */
.emoji-option input[type="radio"]:checked ~ .emoji-text,
.emoji-option:has(input[type="radio"]:checked) .emoji-text {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Backup per browser che non supportano :has() */
.emoji-option.selected {
    border-color: #667eea !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.emoji-option.selected .emoji-text {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.emoji {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.emoji-option:hover .emoji {
    transform: scale(1.2);
}

.emoji-text {
    font-size: 13px;
    color: #555;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* Textarea note */
.survey-question textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s ease;
}

.survey-question textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #fafbff;
}

.char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .emoji-rating {
        flex-direction: column;
    }
    
    .emoji-option {
        min-width: 100%;
    }
    
    .attestati-survey {
        padding: 20px 15px;
    }
    
    .survey-title {
        font-size: 18px;
    }
}

/* Animazione quando selezionato */
.emoji-option:has(input[type="radio"]:checked) .emoji {
    animation: emoji-bounce 0.5s ease;
}

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

