/**
 * WP-Polls Enhanced - Modern Styling
 * Enhanced CSS for modern poll display
 */

/* CSS Variables for theming */
:root {
    --wp-polls-primary: #007cba;
    --wp-polls-secondary: #005a87;
    --wp-polls-accent: #4facfe;
    --wp-polls-success: #28a745;
    --wp-polls-warning: #ffc107;
    --wp-polls-danger: #dc3545;
    --wp-polls-light: #f8f9fa;
    --wp-polls-dark: #343a40;
    --wp-polls-border: #e9ecef;
    --wp-polls-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --wp-polls-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --wp-polls-border-radius: 12px;
    --wp-polls-transition: all 0.3s ease;
}

/* Enhanced Poll Container */
.wp-poll-enhanced {
    background: #ffffff;
    border-radius: var(--wp-polls-border-radius);
    box-shadow: var(--wp-polls-shadow);
    padding: 24px;
    margin: 24px 0;
    border: 1px solid var(--wp-polls-border);
    transition: var(--wp-polls-transition);
    position: relative;
    overflow: hidden;
}

.wp-poll-enhanced:hover {
    box-shadow: var(--wp-polls-shadow-hover);
}

/* Poll Question Styling */
.wp-poll-enhanced .poll-question,
.wp-poll-enhanced h4 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.4;
    text-align: center;
}

/* Poll Options */
.wp-poll-enhanced .poll-options,
.wp-poll-enhanced ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Poll option containers handled by the main li styling below */

.wp-poll-enhanced .poll-option,
.wp-poll-enhanced li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--wp-polls-light);
    border: 1px solid var(--wp-polls-border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--wp-polls-transition);
    font-weight: 500;
    color: #34495e;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.3;
    margin-bottom: 8px;
}

.wp-poll-enhanced .poll-option label,
.wp-poll-enhanced li label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.wp-poll-enhanced .poll-option:hover,
.wp-poll-enhanced li:hover {
    background: #e3f2fd;
    border-color: var(--wp-polls-primary);
    transform: translateY(-1px);
}

/* Radio Button Styling */
.wp-poll-enhanced input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--wp-polls-primary);
    cursor: pointer;
}

/* Compact layout for polls with short options */
.wp-poll-enhanced.wp-poll-compact .poll-options,
.wp-poll-enhanced.wp-poll-compact ul,
.wp-poll-enhanced.wp-poll-compact .wp-polls-ans ul {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 8px !important;
    align-items: stretch !important;
}

.wp-poll-enhanced.wp-poll-compact .poll-option,
.wp-poll-enhanced.wp-poll-compact li,
.wp-poll-enhanced.wp-poll-compact .wp-polls-ans li {
    margin-bottom: 0 !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Poll Actions */
.wp-poll-enhanced .poll-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.wp-poll-enhanced .poll-vote-btn,
.wp-poll-enhanced .poll-results-btn,
.wp-poll-enhanced input[type="submit"],
.wp-poll-enhanced button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--wp-polls-transition);
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.wp-poll-enhanced .poll-vote-btn,
.wp-poll-enhanced input[type="submit"] {
    background: linear-gradient(135deg, var(--wp-polls-primary) 0%, var(--wp-polls-secondary) 100%);
    color: white;
    flex: 1;
}

.wp-poll-enhanced .poll-vote-btn:hover,
.wp-poll-enhanced input[type="submit"]:hover {
    background: linear-gradient(135deg, var(--wp-polls-secondary) 0%, var(--wp-polls-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.4);
}

.wp-poll-enhanced .poll-results-btn {
    background: #6c757d;
    color: white;
    flex: 1;
}

.wp-poll-enhanced .poll-results-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Poll Results */
.wp-poll-enhanced .poll-results {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--wp-polls-border);
    animation: slideIn 0.5s ease;
}

.wp-poll-enhanced .poll-results h5 {
    margin-bottom: 16px;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.wp-poll-enhanced .poll-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wp-poll-enhanced .poll-result-item {
    margin-bottom: 16px;
    background: #ffffff;
    border: 1px solid var(--wp-polls-border);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.wp-poll-enhanced .result-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.wp-poll-enhanced .result-text .answer {
    flex: 1;
    font-weight: 500;
    color: #495057;
}

.wp-poll-enhanced .result-text .percentage {
    font-weight: 600;
    color: var(--wp-polls-primary);
    margin-left: 8px;
}

.wp-poll-enhanced .result-text .votes {
    color: #6c757d;
    font-size: 12px;
    margin-left: 4px;
}

/* Progress Bars - Respect original WP-Polls settings */
.wp-poll-enhanced .result-bar {
    background: var(--wp-polls-border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.wp-poll-enhanced .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wp-polls-accent) 0%, var(--wp-polls-primary) 100%);
    border-radius: 4px;
    transition: width 0.8s ease;
    box-shadow: 0 2px 4px rgba(79, 172, 254, 0.3);
}

/* Let original WP-Polls styles take precedence for .wp-polls-bar */
.wp-poll-enhanced .wp-polls-bar {
    /* Remove our overrides to respect original poll settings */
    transition: width 0.8s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Alternative bar colors for variety - only for custom .bar-fill elements */
.wp-poll-enhanced .poll-result-item:nth-child(2n) .bar-fill {
    background: linear-gradient(90deg, #a8edea 0%, #fed6e3 100%);
}

.wp-poll-enhanced .poll-result-item:nth-child(3n) .bar-fill {
    background: linear-gradient(90deg, #ffecd2 0%, #fcb69f 100%);
}

.wp-poll-enhanced .poll-result-item:nth-child(4n) .bar-fill {
    background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 100%);
}

/* For original WP-Polls bars, respect the admin settings completely */
.wp-poll-enhanced .wp-polls-bar {
    /* Let WP-Polls handle all styling - height, colors, borders from admin settings */
}

/* Poll Statistics */
.wp-poll-enhanced .poll-total,
.wp-poll-enhanced .wp-polls-total {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--wp-polls-border);
    color: #6c757d;
    font-weight: 500;
}

/* Loading Animation */
.wp-poll-enhanced .poll-loading {
    text-align: center;
    padding: 20px;
}

.wp-poll-enhanced .poll-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wp-polls-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Card Style Variations */
.wp-poll-enhanced.wp-poll-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: none;
    overflow: hidden;
}

.wp-poll-enhanced.wp-poll-card .poll-question {
    background: var(--wp-polls-light);
    margin: -24px -24px 16px -24px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--wp-polls-border);
}

.wp-poll-enhanced.wp-poll-card .poll-option,
.wp-poll-enhanced.wp-poll-card li {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
}

/* Minimal Style */
.wp-poll-enhanced.wp-poll-minimal {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 16px 0;
}

.wp-poll-enhanced.wp-poll-minimal .poll-question {
    font-size: 18px;
    text-align: left;
    margin-bottom: 16px;
}

.wp-poll-enhanced.wp-poll-minimal .poll-option,
.wp-poll-enhanced.wp-poll-minimal li {
    background: var(--wp-polls-light);
    border: 1px solid #dee2e6;
    margin-bottom: 6px;
    padding: 6px 10px;
    border-radius: 4px;
}

/* Featured Style */
.wp-poll-enhanced.wp-poll-featured {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    position: relative;
}

.wp-poll-enhanced.wp-poll-featured::before {
    content: 'Featured';
    position: absolute;
    top: 8px;
    right: 16px;
    background: #ff6b35;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.wp-poll-enhanced.wp-poll-featured .poll-question {
    color: white;
}

.wp-poll-enhanced.wp-poll-featured .poll-option,
.wp-poll-enhanced.wp-poll-featured li {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.wp-poll-enhanced.wp-poll-featured .poll-option:hover,
.wp-poll-enhanced.wp-poll-featured li:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Featured poll vote button styling - higher specificity to override original WP-Polls */
.wp-poll-enhanced.wp-poll-featured .poll-vote-btn,
.wp-poll-enhanced.wp-poll-featured input[type="submit"],
.wp-poll-enhanced.wp-poll-featured input[type="button"],
.wp-poll-enhanced.wp-poll-featured button,
.wp-poll-enhanced.wp-poll-featured .Buttons {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    font-weight: 600 !important;
    text-shadow: none !important;
}

.wp-poll-enhanced.wp-poll-featured .poll-vote-btn:hover,
.wp-poll-enhanced.wp-poll-featured input[type="submit"]:hover,
.wp-poll-enhanced.wp-poll-featured input[type="button"]:hover,
.wp-poll-enhanced.wp-poll-featured button:hover,
.wp-poll-enhanced.wp-poll-featured .Buttons:hover {
    background: #f8f9fa !important;
    background-color: #f8f9fa !important;
    color: #222222 !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4) !important;
}

.wp-poll-enhanced.wp-poll-featured .poll-results-btn {
    background: rgba(0, 0, 0, 0.3) !important;
    background-color: rgba(0, 0, 0, 0.3) !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    font-weight: 600 !important;
}

.wp-poll-enhanced.wp-poll-featured .poll-results-btn:hover {
    background: rgba(0, 0, 0, 0.5) !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    color: #ffffff !important;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes */
.wp-poll-enhanced.animate-fade {
    animation: fadeIn 0.5s ease;
}

.wp-poll-enhanced.animate-slide {
    animation: slideIn 0.5s ease;
}

.wp-poll-enhanced.animate-bounce {
    animation: bounceIn 0.6s ease;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wp-poll-enhanced {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .wp-poll-enhanced .poll-question {
        color: #ecf0f1;
    }
    
    .wp-poll-enhanced .poll-option label {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .wp-poll-enhanced .poll-option label:hover {
        background: #4a5f7a;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .wp-poll-enhanced {
        padding: 16px;
        margin: 16px 0;
    }
    
    .wp-poll-enhanced .poll-question {
        font-size: 18px;
    }
    
    .wp-poll-enhanced .poll-actions {
        flex-direction: column;
    }
    
    .wp-poll-enhanced .poll-actions button {
        width: 100%;
        margin: 5px 0;
    }
    
    .wp-poll-enhanced .result-text {
        flex-wrap: wrap;
    }
    
    .wp-poll-enhanced .result-text .percentage,
    .wp-poll-enhanced .result-text .votes {
        margin-left: 0;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .wp-poll-enhanced {
        padding: 12px;
        margin: 12px 0;
    }
    
    .wp-poll-enhanced .poll-question {
        font-size: 16px;
    }
    
    .wp-poll-enhanced .poll-option label {
        padding: 8px 12px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .wp-poll-enhanced {
        border: 2px solid #000;
    }
    
    .wp-poll-enhanced .poll-option label {
        border: 2px solid #000;
    }
    
    .wp-poll-enhanced .poll-vote-btn {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .wp-poll-enhanced,
    .wp-poll-enhanced *,
    .wp-poll-enhanced *::before,
    .wp-poll-enhanced *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .wp-poll-enhanced {
        box-shadow: none;
        border: 1px solid #000;
        background: #fff !important;
        color: #000 !important;
    }
    
    .wp-poll-enhanced .poll-actions {
        display: none;
    }
    
    .wp-poll-enhanced .poll-results {
        display: block !important;
    }
}