/**
 * Poll Widget Styles
 */

/* Homepage Block Wrapper */
.poll-block-wrapper {
    margin-bottom: 30px;
}

.poll-block-wrapper .section-header {
    margin-bottom: 16px;
}

.poll-block-wrapper .section-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
}

/* Sidebar Widget Wrapper */
.widget-poll {
    margin-bottom: 20px;
}

.widget-poll .poll-widget {
    border-radius: 8px;
}

.poll-widget {
    --poll-primary: #667eea;
    --poll-bg: #ffffff;
    --poll-border: #e5e7eb;
    --poll-text: #374151;
    --poll-text-muted: #6b7280;
    --poll-radius: 12px;

    background: var(--poll-bg);
    border: 1px solid var(--poll-border);
    border-radius: var(--poll-radius);
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.poll-header {
    margin-bottom: 16px;
}

.poll-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--poll-text);
    line-height: 1.4;
}

.poll-description {
    margin: 0;
    font-size: 14px;
    color: var(--poll-text-muted);
    line-height: 1.5;
}

/* Voting Form */
.poll-form {
    margin: 0;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.poll-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poll-option:hover {
    background: #f3f4f6;
    border-color: var(--poll-primary);
}

.poll-option input {
    display: none;
}

.poll-option .option-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.poll-option input[type="checkbox"] + .option-indicator {
    border-radius: 4px;
}

.poll-option input:checked + .option-indicator {
    border-color: var(--poll-primary);
    background: var(--poll-primary);
}

.poll-option input:checked + .option-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.poll-option input[type="checkbox"]:checked + .option-indicator::after {
    width: 10px;
    height: 6px;
    background: none;
    border: 2px solid white;
    border-top: none;
    border-right: none;
    border-radius: 0;
    transform: translate(-50%, -60%) rotate(-45deg);
}

.poll-option .option-text {
    font-size: 15px;
    color: var(--poll-text);
    flex: 1;
}

/* Submit Button */
.poll-submit {
    width: 100%;
    padding: 12px 20px;
    background: var(--poll-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poll-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.poll-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.poll-submit .submit-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Results */
.poll-results {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--poll-text);
}

.result-percent {
    font-size: 14px;
    font-weight: 600;
    color: var(--poll-primary);
}

.result-bar {
    height: 10px;
    background: #f3f4f6;
    border-radius: 5px;
    overflow: hidden;
}

.result-fill {
    height: 100%;
    background: var(--poll-primary);
    border-radius: 5px;
    transition: width 0.8s ease-out;
}

.poll-animated .result-fill {
    width: 0 !important;
    animation: fillBar 0.8s ease-out forwards;
}

@keyframes fillBar {
    to { width: var(--fill-width, 0%); }
}

.result-votes {
    font-size: 12px;
    color: var(--poll-text-muted);
}

/* Footer */
.poll-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--poll-border);
    font-size: 13px;
    color: var(--poll-text-muted);
}

.poll-total {
    font-weight: 500;
}

.poll-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.poll-status.poll-closed {
    color: #dc2626;
}

/* Message */
.poll-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.poll-message.success {
    background: #d1fae5;
    color: #065f46;
}

.poll-message.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Compact Style */
.poll-widget.poll-compact {
    padding: 16px;
}

.poll-compact .poll-title {
    font-size: 16px;
    margin-bottom: 4px;
}

.poll-compact .poll-options {
    gap: 8px;
    margin-bottom: 12px;
}

.poll-compact .poll-option {
    padding: 10px 12px;
}

.poll-compact .poll-option .option-indicator {
    width: 18px;
    height: 18px;
}

.poll-compact .poll-option .option-text {
    font-size: 14px;
}

.poll-compact .poll-submit {
    padding: 10px 16px;
    font-size: 14px;
}

.poll-compact .result-bar {
    height: 8px;
}

.poll-compact .poll-footer {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 480px) {
    .poll-widget {
        padding: 16px;
        border-radius: 10px;
    }

    .poll-title {
        font-size: 16px;
    }

    .poll-option {
        padding: 10px 12px;
    }

    .poll-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Loading State */
.poll-widget.loading {
    opacity: 0.7;
    pointer-events: none;
}

.poll-widget.loading .poll-submit {
    cursor: wait;
}
