/* TouchPoint Poll - Styles */

:root {
    --tpv-cyan: #21c4ff;
    --tpv-cyan-dark: #1ba8dd;
    --tpv-dark: #1a1a2e;
    --tpv-darker: #12121f;
    --tpv-light: #ffffff;
    --tpv-gray: #6b7280;
    --tpv-success: #10b981;
    --tpv-error: #ef4444;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--tpv-darker) 0%, var(--tpv-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--tpv-light);
}

.poll-container {
    width: 100%;
    max-width: 420px;
}

/* Poll Card */
.poll-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.poll-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.poll-badge {
    background: var(--tpv-cyan);
    color: var(--tpv-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.poll-type {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--tpv-gray);
}

.poll-type.trivia {
    background: rgba(16, 185, 129, 0.2);
    color: var(--tpv-success);
}

.poll-type.opinion {
    background: rgba(33, 196, 255, 0.2);
    color: var(--tpv-cyan);
}

.poll-question {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 20px;
    color: var(--tpv-light);
}

/* Options */
.poll-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.poll-option {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--tpv-light);
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 500;
}

.poll-option:hover:not(.voted):not(.disabled) {
    border-color: var(--tpv-cyan);
    background: rgba(33, 196, 255, 0.1);
    transform: translateY(-2px);
}

.poll-option:active:not(.voted):not(.disabled) {
    transform: translateY(0);
}

.option-text {
    position: relative;
    z-index: 2;
}

.option-pct {
    position: relative;
    z-index: 2;
    font-weight: 700;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.poll-option.show-results .option-pct {
    opacity: 1;
}

.option-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(33, 196, 255, 0.3), rgba(33, 196, 255, 0.15));
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
    border-radius: 10px;
}

.poll-option.show-results .option-bar {
    width: var(--pct);
}

.poll-option.selected {
    border-color: var(--tpv-cyan);
    background: rgba(33, 196, 255, 0.15);
}

.poll-option.selected .option-pct {
    display: none;
}

.poll-option.selected::before {
    content: '✓';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--tpv-cyan);
    z-index: 3;
    opacity: 0;
    animation: checkIn 0.3s ease forwards 0.3s;
}

@keyframes checkIn {
    from { opacity: 0; transform: translateY(-50%) scale(0); }
    to { opacity: 1; transform: translateY(-50%) scale(1); }
}

.poll-option.correct {
    border-color: var(--tpv-success);
}

.poll-option.correct .option-bar {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.4), rgba(16, 185, 129, 0.2));
}

.poll-option.disabled {
    cursor: default;
    pointer-events: none;
}

/* Loading state */
.poll-option.loading {
    pointer-events: none;
}

.poll-option.loading::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--tpv-cyan);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Footer */
.poll-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.vote-count {
    font-size: 13px;
    color: var(--tpv-gray);
    font-weight: 500;
}

.poll-branding {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--tpv-gray);
    font-size: 11px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.poll-branding:hover {
    opacity: 1;
}

.poll-branding img {
    height: 16px;
    width: auto;
}

/* Result Message */
.result-message {
    text-align: center;
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.result-message.show {
    opacity: 1;
    transform: translateY(0);
}

.result-message.correct {
    background: rgba(16, 185, 129, 0.2);
    color: var(--tpv-success);
}

.result-message.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--tpv-error);
}

.result-message.opinion {
    background: rgba(33, 196, 255, 0.2);
    color: var(--tpv-cyan);
}

/* Welcome/Error screens */
.poll-welcome,
.poll-error {
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon,
.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.poll-welcome h2,
.poll-error h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.poll-welcome p,
.poll-error p {
    color: var(--tpv-gray);
    margin-bottom: 24px;
}

.poll-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    text-align: left;
}

.poll-list h3 {
    font-size: 12px;
    color: var(--tpv-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.poll-link {
    display: block;
    padding: 12px;
    color: var(--tpv-light);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}

.poll-link:hover {
    background: rgba(33, 196, 255, 0.1);
}

/* Confetti effect */
@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--tpv-cyan);
    animation: confetti 1s ease-out forwards;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .poll-card {
        padding: 20px 16px;
    }
    
    .poll-question {
        font-size: 18px;
    }
    
    .poll-option {
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* Light mode variant (add class="light" to body) */
body.light {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--tpv-dark);
}

body.light .poll-card {
    background: white;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

body.light .poll-question {
    color: var(--tpv-dark);
}

body.light .poll-option {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: var(--tpv-dark);
}

body.light .poll-option:hover:not(.voted):not(.disabled) {
    background: rgba(33, 196, 255, 0.1);
}
