/* Sondage Images - Styles */

/* Container principal */
.sondage-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.sondage-header {
    text-align: center;
    margin-bottom: 30px;
}

.sondage-header h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #333;
}

.sondage-description {
    font-size: 1.1em;
    color: #666;
}

.sondage-deadline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff3cd;
    color: #856404;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
}

/* Étapes */
.sondage-step {
    display: none;
}

.sondage-step.active {
    display: block;
}

.sondage-instruction {
    text-align: center;
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

/* Filtre recherche */
.sondage-filter {
    text-align: center;
    margin-bottom: 25px;
}

#sondage-search {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s;
}

#sondage-search:focus {
    border-color: #0073aa;
}

/* Grille d'images */
.sondage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sondage-image-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    background: #f5f5f5;
}

.sondage-image-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.sondage-image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.sondage-image-name {
    display: block;
    padding: 10px;
    font-size: 0.85em;
    color: #333;
    background: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sondage-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

.sondage-image-item.selected {
    outline: 4px solid #4CAF50;
}

.sondage-image-item.selected .sondage-check {
    display: flex;
}

.sondage-image-item.hidden {
    display: none;
}

/* Prévisualisation sélection */
.sondage-selected-preview {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.sondage-selected-preview h3 {
    margin-top: 0;
    color: #333;
}

.sondage-selected-preview img {
    max-width: 300px;
    max-height: 250px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
}

#sondage-selected-name {
    font-size: 1.1em;
    color: #555;
    margin: 15px 0;
}

/* Formulaire */
.sondage-form {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

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

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

.sondage-field input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.sondage-field input[type="email"]:focus {
    border-color: #0073aa;
}

.sondage-field-info {
    display: block;
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

.sondage-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: normal;
    cursor: pointer;
}

.sondage-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Boutons */
.sondage-btn-primary,
.sondage-btn-secondary {
    display: inline-block;
    padding: 14px 30px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.sondage-btn-primary {
    width: 100%;
    background: #0073aa;
    color: white;
}

.sondage-btn-primary:hover {
    background: #005a87;
}

.sondage-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.sondage-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.sondage-btn-secondary:hover {
    background: #e0e0e0;
}

/* Messages */
.sondage-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    display: none;
}

.sondage-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
}

.sondage-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
}

/* Succès */
.sondage-success {
    text-align: center;
    margin-bottom: 30px;
}

.sondage-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #4CAF50;
    color: white;
    font-size: 40px;
    border-radius: 50%;
    margin-bottom: 15px;
}

.sondage-success h3 {
    font-size: 1.5em;
    color: #333;
}

/* Résultats */
.sondage-results {
    max-width: 600px;
    margin: 0 auto;
}

.sondage-results h3 {
    text-align: center;
    margin-bottom: 20px;
}

.sondage-results-total {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

.sondage-results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sondage-result-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.sondage-result-row.voted {
    background: #e8f5e9;
    border: 2px solid #4CAF50;
}

.sondage-result-rank {
    font-size: 1.2em;
    font-weight: bold;
    color: #0073aa;
    min-width: 40px;
}

.sondage-result-row img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.sondage-result-data {
    flex: 1;
}

.sondage-result-name {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.sondage-result-bar-container {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 5px;
}

.sondage-result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.sondage-result-percent {
    font-size: 0.85em;
    color: #666;
}

.sondage-your-vote {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    color: #856404;
}

/* Résultats finaux (sondage terminé) */
.sondage-final-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.sondage-result-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sondage-result-item.rank-1 {
    background: linear-gradient(135deg, #fff9c4, #fff);
    border: 2px solid #ffd700;
}

.sondage-result-item.rank-2 {
    background: linear-gradient(135deg, #f5f5f5, #fff);
    border: 2px solid #c0c0c0;
}

.sondage-result-item.rank-3 {
    background: linear-gradient(135deg, #ffe0b2, #fff);
    border: 2px solid #cd7f32;
}

.sondage-rank {
    font-size: 2em;
    min-width: 50px;
    text-align: center;
}

.sondage-result-item img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.sondage-result-info {
    flex: 1;
}

.sondage-result-info .sondage-result-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
}

.sondage-result-bar {
    height: 15px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sondage-result-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 8px;
}

.sondage-result-stats {
    font-size: 0.9em;
    color: #666;
}

.sondage-total {
    text-align: center;
    font-size: 1.1em;
    color: #555;
    margin-top: 30px;
}

/* Modal zoom */
.sondage-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.sondage-modal.active {
    display: flex;
}

.sondage-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.sondage-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: color 0.3s;
}

.sondage-modal-close:hover {
    color: #ff6b6b;
}

/* Loading */
.sondage-loading {
    text-align: center;
    padding: 40px;
}

.sondage-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: sondage-spin 1s linear infinite;
}

@keyframes sondage-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Erreur */
.sondage-error {
    text-align: center;
    padding: 40px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .sondage-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .sondage-image-item img {
        height: 120px;
    }
    
    .sondage-form {
        padding: 20px;
    }
    
    .sondage-result-item {
        flex-wrap: wrap;
    }
    
    .sondage-result-item img {
        width: 80px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .sondage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .sondage-image-item img {
        height: 100px;
    }
    
    .sondage-header h2 {
        font-size: 1.5em;
    }
}
