/**
 * ================================================================
 * Poll - Sondage collaboratif (Mobile-First v3.21.0)
 * ================================================================
 *
 * Activité sondage avec graphiques animés et résultats temps réel
 * Architecture mobile-first avec breakpoints progressifs
 *
 * @version 3.21.0
 */

/* ================================================================
   1. CSS VARIABLES
   ================================================================ */
:root {
    --cal-primary: #667eea; /* v3.9.4 - Fallback simplifié */
    --cal-white: #FFFFFF;
    --cal-text: #333333;
    --cal-text-muted: #666666;

    --poll-primary: #4ecdc4;
    --poll-secondary: #44a08d;
    --poll-gradient: linear-gradient(135deg, var(--poll-primary) 0%, var(--poll-secondary) 100%);
    --poll-bg-light: rgba(78, 205, 196, 0.1);
    --poll-border: #e0e0e0;

    --cal-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --cal-font-size-sm: 14px;
    --cal-font-size-base: 16px;
    --cal-font-size-lg: 18px;
    --cal-font-size-xl: 24px;
    --cal-font-size-2xl: 32px;
    --cal-font-size-3xl: 40px;
    --cal-font-size-4xl: 64px;

    --cal-spacing-xs: 8px;
    --cal-spacing-sm: 10px;
    --cal-spacing-md: 15px;
    --cal-spacing-lg: 20px;
    --cal-spacing-xl: 30px;
    --cal-spacing-2xl: 40px;

    --cal-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --cal-shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
    --cal-shadow-button: 0 4px 12px rgba(78, 205, 196, 0.3);
    --cal-shadow-button-hover: 0 6px 16px rgba(78, 205, 196, 0.4);

    --cal-radius-sm: 10px;
    --cal-radius-md: 15px;
    --cal-radius-lg: 20px;
    --cal-radius-xl: 25px;
    --cal-radius-full: 9999px;

    --cal-transition-base: 0.3s ease;
    --cal-transition-slow: 0.5s ease;
}

/* ================================================================
   2. CONTAINER
   ================================================================ */
.poll-container {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--cal-spacing-lg);
    font-family: var(--cal-font-family);
}

@media (min-width: 768px) {
    .poll-container {
        max-width: 900px;
    }
}

/* ================================================================
   3. HEADER
   ================================================================ */
.poll-header {
    text-align: center;
    margin-bottom: var(--cal-spacing-2xl);
}

.poll-header h2 {
    font-size: var(--cal-font-size-2xl);
    margin-bottom: var(--cal-spacing-md);
    background: var(--poll-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    .poll-header h2 {
        font-size: 2.5em;
    }
}

.poll-intro {
    font-size: var(--cal-font-size-base);
    color: var(--cal-text-muted);
    line-height: 1.6;
}

@media (min-width: 768px) {
    .poll-intro {
        font-size: 1.1em;
    }
}

/* ================================================================
   4. QUESTION SECTION
   ================================================================ */
.poll-question-section {
    text-align: center;
    padding: var(--cal-spacing-xl);
    background: linear-gradient(135deg, var(--poll-bg-light) 0%, rgba(68, 160, 141, 0.1) 100%);
    border-radius: var(--cal-radius-lg);
    margin-bottom: var(--cal-spacing-2xl);
}

.question-icon {
    font-size: var(--cal-font-size-3xl);
    margin-bottom: var(--cal-spacing-md);
}

@media (min-width: 768px) {
    .question-icon {
        font-size: var(--cal-font-size-4xl);
    }
}

.poll-question {
    font-size: var(--cal-font-size-xl);
    margin: 0 0 var(--cal-spacing-lg) 0;
    color: var(--cal-text);
}

@media (min-width: 768px) {
    .poll-question {
        font-size: 1.8em;
    }
}

.poll-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--cal-spacing-lg);
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: var(--cal-spacing-xs);
    padding: var(--cal-spacing-sm) var(--cal-spacing-lg);
    background: var(--cal-white);
    border-radius: var(--cal-radius-xl);
    box-shadow: var(--cal-shadow-sm);
}

.stat-icon {
    font-size: 1.3em;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--poll-primary);
}

.stat-label {
    font-size: var(--cal-font-size-sm);
    color: var(--cal-text-muted);
}

/* ================================================================
   5. OPTIONS - Radio/Checkbox invisibles avec card cliquable
   ================================================================ */
.poll-options {
    margin-bottom: var(--cal-spacing-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--cal-spacing-md);
}

.poll-option {
    position: relative;
    cursor: pointer;
    margin-bottom: 0;
}

/* Masquer les radio/checkbox */
.poll-option input[type="radio"],
.poll-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Card stylisée comme un bouton complet */
.option-card {
    display: flex;
    align-items: center;
    gap: var(--cal-spacing-md);
    padding: var(--cal-spacing-lg);
    background: var(--cal-white);
    border: 3px solid var(--poll-border);
    border-radius: var(--cal-radius-md);
    transition: all var(--cal-transition-base);
    min-height: 64px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

@media (hover: hover) {
    .poll-option:hover .option-card {
        border-color: var(--poll-primary);
        background: var(--poll-bg-light);
        transform: translateX(5px) translate3d(0, 0, 0);
        box-shadow: var(--cal-shadow-md);
    }
}

@media (hover: none) {
    .poll-option:active .option-card {
        opacity: 0.85;
        transform: scale(0.99) translate3d(0, 0, 0);
    }
}

/* État sélectionné - Multiple sélecteurs pour compatibilité */
.poll-option input:checked + .option-card,
.poll-option.selected .option-card,
.poll-option:has(input:checked) .option-card {
    border-color: var(--poll-primary);
    background: var(--poll-bg-light);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.option-emoji {
    font-size: 1.8em;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .option-emoji {
        font-size: 2em;
    }
}

.option-text {
    font-size: var(--cal-font-size-base);
    font-weight: 600;
    color: var(--cal-text);
    flex: 1;
}

@media (min-width: 768px) {
    .option-text {
        font-size: var(--cal-font-size-lg);
    }
}

/* Icône de vérification */
.option-check {
    font-size: 1.5em;
    color: var(--poll-primary);
    font-weight: 700;
    opacity: 0;
    transition: opacity var(--cal-transition-fast);
    flex-shrink: 0;
}

.poll-option input:checked + .option-card .option-check,
.poll-option.selected .option-check,
.poll-option:has(input:checked) .option-check {
    opacity: 1;
}

.submit-vote-btn {
    width: 100%;
    padding: var(--cal-spacing-md);
    background: var(--poll-gradient);
    color: var(--cal-white);
    border: none;
    border-radius: var(--cal-radius-md);
    font-size: var(--cal-font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cal-transition-base);
    box-shadow: var(--cal-shadow-button);
    min-height: 56px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

@media (min-width: 768px) {
    .submit-vote-btn {
        font-size: var(--cal-font-size-lg);
    }
}

.submit-vote-btn:hover {
    transform: translateY(-2px) translate3d(0, 0, 0);
    box-shadow: var(--cal-shadow-button-hover);
}

@media (hover: none) {
    .submit-vote-btn:active {
        opacity: 0.85;
        transform: scale(0.98) translate3d(0, 0, 0);
    }
}

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

/* ================================================================
   6. RÉSULTATS
   ================================================================ */
.poll-results {
    background: var(--cal-white);
    border-radius: var(--cal-radius-lg);
    padding: var(--cal-spacing-xl);
    box-shadow: var(--cal-shadow-md);
}

.results-header h3 {
    font-size: var(--cal-font-size-xl);
    margin-bottom: var(--cal-spacing-xl);
    text-align: center;
    color: var(--cal-text);
}

.result-item {
    margin-bottom: var(--cal-spacing-xl);
}

.result-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--cal-spacing-xs);
    font-weight: 600;
    color: var(--cal-text);
}

.result-percentage {
    color: var(--poll-primary);
}

.result-bar-container {
    position: relative;
    height: 40px;
    background: #f0f0f0;
    border-radius: var(--cal-radius-sm);
    overflow: hidden;
}

.result-bar {
    height: 100%;
    background: var(--poll-gradient);
    transition: width var(--cal-transition-slow);
    display: flex;
    align-items: center;
    padding: 0 var(--cal-spacing-md);
    color: var(--cal-white);
    font-weight: 600;
    transform: translate3d(0, 0, 0);
}

.result-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.result-count {
    margin-top: var(--cal-spacing-xs);
    font-size: var(--cal-font-size-sm);
    color: var(--cal-text-muted);
}
