﻿/**
 * ThreeGigs v25 Poll Component Styles
 * Modern, minimal, and reusable poll styling
 */

/* ============================================
   Poll Container
   ============================================ */
.poll-container {
    --poll-gap: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--poll-gap);
}

.poll-card {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--transition-base);
}

    .poll-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-float);
    }

/* Poll Header */
.poll-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--glass-border);
}

.poll-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.poll-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.poll-timer {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.poll-timer--urgent {
    color: var(--danger);
    animation: pulse 2s infinite;
}

/* ============================================
   Poll Options
   ============================================ */
.poll-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--glass-surface-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
}

    .poll-option:hover {
        background: var(--glass-surface);
        transform: translateX(4px);
    }

.poll-option--selected {
    border-color: var(--primary);
    background: var(--primary-alpha-10);
}

.poll-option--correct {
    border-color: var(--success);
    background: var(--success-alpha-10);
}

.poll-option--incorrect {
    border-color: var(--danger);
    background: var(--danger-alpha-10);
}

/* Progress Bar */
.poll-option__progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-alpha-20) 0%, var(--primary-alpha-10) 100%);
    transition: width var(--transition-smooth);
    z-index: 0;
}

.poll-option__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.poll-option__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--glass-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
}

.poll-option__text {
    flex: 1;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.poll-option__votes {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.poll-results-visible .poll-option__votes {
    opacity: 1;
}

/* ============================================
   Metric-Specific Styles
   ============================================ */

/* Vote (Radio) Style */
.poll-option--vote::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    left: var(--space-4);
    transition: all var(--transition-base);
}

.poll-option--vote.poll-option--selected::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px var(--surface);
}

/* Star Rating Style */
.star-rating {
    display: flex;
    gap: var(--space-1);
    margin-left: auto;
}

.star {
    font-size: var(--text-xl);
    color: var(--border-color);
    cursor: pointer;
    transition: all var(--transition-base);
}

    .star:hover,
    .star--filled {
        color: var(--warning);
        transform: scale(1.1);
    }

/* Percentage Slider Style */
.poll-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--glass-surface);
    border-radius: var(--radius-full);
    outline: none;
    margin: var(--space-2) 0;
    flex: 1;
}

    .poll-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: var(--primary);
        border-radius: var(--radius-full);
        cursor: pointer;
        transition: all var(--transition-base);
    }

        .poll-slider::-webkit-slider-thumb:hover {
            transform: scale(1.2);
            box-shadow: var(--shadow-glow-primary);
        }

.poll-slider-value {
    min-width: 45px;
    text-align: right;
    font-weight: var(--font-semibold);
    color: var(--primary);
}

/* Quiz Style */
.poll--quiz .poll-option {
    min-height: 60px;
}

    .poll--quiz .poll-option::after {
        content: '';
        position: absolute;
        right: var(--space-4);
        width: 24px;
        height: 24px;
        border-radius: var(--radius-full);
        display: none;
    }

.poll--quiz .poll-option--correct::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    color: white;
}

.poll--quiz .poll-option--incorrect::after {
    content: '✗';
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
}

/* ============================================
   Poll Actions
   ============================================ */
.poll-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--glass-border);
}

.poll-action {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

    .poll-action:hover {
        color: var(--primary);
        border-color: var(--primary);
        background: var(--primary-alpha-10);
    }

/* ============================================
   Poll States
   ============================================ */

/* Loading Skeleton */
.poll-skeleton {
    padding: var(--space-5);
}

.skeleton {
    background: linear-gradient(90deg, var(--glass-surface) 0%, var(--glass-surface-light) 50%, var(--glass-surface) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton--title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-4);
}

.skeleton--option {
    height: 48px;
    margin-bottom: var(--space-2);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Error State */
.poll-error {
    text-align: center;
    padding: var(--space-6);
    color: var(--text-secondary);
}

    .poll-error .icon {
        font-size: var(--text-3xl);
        color: var(--danger);
        margin-bottom: var(--space-3);
    }

/* Empty State */
.poll-empty {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-secondary);
}

/* ============================================
   Animations
   ============================================ */
.poll-results-enter {
    animation: slideIn var(--transition-smooth) forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Ripple Effect for Votes */
.poll-option--vote::after {
    content: '';
    position: absolute;
    top: 50%;
    left: var(--space-4);
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--primary);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.poll-option--vote:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .poll-card {
        padding: var(--space-4);
        border-radius: var(--radius-md);
    }

    .poll-option {
        padding: var(--space-3);
    }

    .poll-option__icon {
        width: 32px;
        height: 32px;
    }

    .poll-actions {
        flex-direction: column;
    }

    .poll-action {
        width: 100%;
        justify-content: center;
    }

    /* Touch-friendly tap targets */
    .poll-option {
        min-height: 56px;
    }

    /* Swipe hint */
    .poll-container--swipeable {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

        .poll-container--swipeable .poll-card {
            scroll-snap-align: center;
            min-width: 90%;
        }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .poll-card {
        background: var(--glass-surface-dark);
    }

    .poll-option__progress {
        background: linear-gradient(90deg, var(--primary-alpha-30) 0%, var(--primary-alpha-15) 100%);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .poll-option,
    .poll-option__progress,
    .star,
    .poll-action {
        transition: none;
    }

    .poll-timer--urgent {
        animation: none;
    }
}
