/**
 * Golf Poll Plugin - Public Styles
 * Modern SaaS-style frontend interface
 */

/* Main Poll Card */
.golf-poll-card {
    max-width: 600px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.golf-poll-title {
    background: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
    color: #fff;
    margin: 0;
    padding: 20px 25px;
    font-size: 1.4em;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Countdown Styles */
.golf-poll-countdown {
    background: #f8f9fa;
    padding: 15px 25px;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}

.countdown-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.countdown-text {
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.countdown-timer {
    background: #2c3e50;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9em;
    min-width: 80px;
    display: inline-block;
}

.countdown-timer.urgent {
    background: #dc3545;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.poll-expiry-info {
    color: #6c757d;
    font-size: 0.85em;
}

.current-date {
    color: #6c757d;
    font-size: 0.8em;
    margin-bottom: 8px;
}

/* Form Styles */
.golf-poll-form {
    padding: 25px;
}

.golf-poll-field {
    margin-bottom: 20px;
    position: relative;
}

.golf-poll-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.golf-poll-field input,
.golf-poll-field select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fff;
    box-sizing: border-box;
}

.golf-poll-field input:focus,
.golf-poll-field select:focus {
    outline: none;
    border-color: #228B22;
    box-shadow: 0 0 0 3px rgba(34, 139, 34, 0.1);
    transform: translateY(-1px);
}

.golf-poll-field.focused input,
.golf-poll-field.focused select {
    border-color: #228B22;
    box-shadow: 0 0 0 3px rgba(34, 139, 34, 0.1);
}

.golf-poll-field.success input,
.golf-poll-field.success select {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.golf-poll-field.error input,
.golf-poll-field.error select {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.field-error-message {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 5px;
    font-weight: 500;
}

.character-counter {
    position: absolute;
    right: 12px;
    top: 35px;
    font-size: 0.8em;
    color: #6c757d;
    pointer-events: none;
}

.character-counter.warning {
    color: #ffc107;
}

.character-counter.danger {
    color: #dc3545;
}

/* Submit Button */
.golf-poll-submit {
    text-align: center;
    margin-top: 25px;
}

.golf-poll-button {
    background: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(34, 139, 34, 0.3);
    min-width: 150px;
}

.golf-poll-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 139, 34, 0.4);
    background: linear-gradient(135deg, #32CD32 0%, #00FF00 100%);
}

.golf-poll-button:active {
    transform: translateY(0);
}

.golf-poll-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Message Styles */
.golf-poll-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    display: none;
}

.golf-poll-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.golf-poll-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.golf-poll-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading States */
.golf-poll-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.golf-poll-button.loading {
    position: relative;
    color: transparent;
}

.golf-poll-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success State */
.golf-poll-success-state {
    text-align: center;
    padding: 40px 25px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.success-icon {
    font-size: 48px;
    color: #28a745;
    margin-bottom: 15px;
}

.golf-poll-success-state h4 {
    color: #155724;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.golf-poll-success-state p {
    color: #155724;
    margin-bottom: 8px;
}

.success-subtext {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Poll Results Styles - Matching Backend Design Exactly */
.golf-poll-results-dashboard {
    margin-top: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Results Header */
.results-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px 8px 0 0;
}

.results-summary {
    display: flex;
    gap: 30px;
}

.summary-stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Vote Distribution Charts */
.results-charts {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.results-charts h3 {
    font-size: 18px;
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-weight: 600;
}

.chart-container {
    margin-bottom: 25px;
}

.chart-container h4 {
    font-size: 14px;
    margin: 0 0 12px 0;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-bars {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.chart-bar {
    margin-bottom: 12px;
}

.chart-bar:last-child {
    margin-bottom: 0;
}

.bar-label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
}

.bar-container {
    position: relative;
    background: #e9ecef;
    height: 32px;
    border-radius: 16px;
    overflow: hidden;
}

.bar-fill {
    background: linear-gradient(90deg, #228B22, #32CD32);
    height: 100%;
    border-radius: 16px;
    transition: width 0.8s ease;
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    z-index: 2;
}

/* Top Choices Summary */
.top-choices {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.top-choices h3 {
    font-size: 18px;
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-weight: 600;
}

.top-choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.top-choice-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #228B22;
    transition: transform 0.2s ease;
}

.top-choice-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.choice-category {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

.choice-value {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.choice-stats {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* No Results State */
.no-results-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-results-icon {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 20px;
}

.no-results-state h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
}

.no-results-state p {
    max-width: 400px;
    margin: 0 auto 10px auto;
    color: #6c757d;
    line-height: 1.5;
}

/* Expired Poll Styles */
.golf-poll-expired {
    opacity: 0.8;
}

.golf-poll-expired .golf-poll-title {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .golf-poll-card {
        margin: 15px;
        border-radius: 8px;
    }
    
    .golf-poll-title {
        padding: 15px 20px;
        font-size: 1.2em;
    }
    
    .golf-poll-form {
        padding: 20px;
    }
    
    .golf-poll-field {
        margin-bottom: 18px;
    }
    
    .golf-poll-button {
        padding: 12px 28px;
        font-size: 1em;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .results-summary {
        justify-content: center;
    }
    
    .top-choices-grid {
        grid-template-columns: 1fr;
    }
    
    .golf-poll-results-dashboard {
        margin-top: 15px;
    }
    
    .results-charts,
    .top-choices {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .golf-poll-card {
        margin: 10px;
    }
    
    .countdown-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .results-summary {
        flex-direction: column;
        gap: 15px;
    }
}

/* Animation for results appearance */
.golf-poll-results-dashboard {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .golf-poll-card {
        border: 2px solid #000;
    }
    
    .golf-poll-button {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}