/* General container for the voting system */
.voting-container {
    max-width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
}

/* Styling for loading states */
.voting-loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

/* Styling for the loading spinner animation */
.voting-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Keyframe animation for the spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styling for the countdown timer display */
.voting-timer {
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

/* No ongoing poll styling */
.no-ongoing-poll {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
    padding: 40px;
    margin: 20px 0;
    border-radius: 10px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
}

.no-ongoing-poll-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #adb5bd;
}

/* The original voting-counter div is now largely unused; its content is now injected into voting-header */
.voting-counter {
    background: #e8f5e8;
    color: #2d5016;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid #4caf50;
}

/* Updated styling for the main header with poll name, times, and vote count */
.voting-header {
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 1.1rem;
}

.voting-header p {
    margin: 5px 0;
    line-height: 1.5;
}

.voting-header strong {
    color: #000000;
}

/* Specific style for the status message within the header */
.voting-header .voting-message {
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Enhanced styling for the voting results section */
.voting-results {
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
}

.voting-results h3 {
    color: #000000;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
}

/* Styling for position sections */
.position-section {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.position-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
}

.position-total-votes {
    background: #f8f9fa;
    color: #495057;
    padding: 10px 20px;
    text-align: center;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
}

/* Enhanced styling for individual result items */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #f8f9fa;
}

/* Highlighting for winners */
.result-item.winner {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 5px solid #28a745;
    font-weight: 600;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.result-item.winner:hover {
    background: linear-gradient(135deg, #c3e6cb 0%, #b8dcc0 100%);
}

.result-item.winner .result-candidate {
    color: #155724;
    font-weight: 700;
}

.result-item.winner .result-votes {
    background: #28a745;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.result-item.winner::before {
    content: "🏆";
    margin-right: 10px;
    font-size: 1.2em;
}

.result-rank {
    font-weight: 600;
    color: #333;
    min-width: 40px;
    text-align: center;
}

.result-candidate {
    font-weight: 500;
    color: #555;
    flex: 1;
    text-align: left;
    margin-left: 20px;
}

.result-votes {
    font-weight: 700;
    color: #007cba;
    background: #e7f3ff;
    padding: 6px 15px;
    border-radius: 20px;
    min-width: 60px;
    text-align: center;
}

.result-percentage {
    font-size: 0.9em;
    color: #666;
    margin-left: 10px;
}

/* Styling for individual poll sections */
.voting-poll-section {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    transition: border-color 0.3s ease;
}

.voting-poll-section:hover {
    border-color: #667eea;
}

.voting-poll-title {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Styling for each candidate option */
.voting-candidate-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9ff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.voting-candidate-option:hover {
    background: #e8ecff;
    transform: translateX(5px);
}

.voting-candidate-option input[type="radio"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.voting-candidate-option label {
    font-size: 1.1rem;
    color: #333;
    cursor: pointer;
    flex-grow: 1;
    font-weight: 500;
}

/* Styling for selected radio button options */
.voting-candidate-option input[type="radio"]:checked + label {
    color: #667eea;
    font-weight: 600;
}

.voting-candidate-option:has(input[type="radio"]:checked) {
    background: #e8ecff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* General message box styling */
.voting-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.voting-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.voting-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Styling for email eligibility error messages */
.email-eligibility-message {
    padding: 20px;
    margin: 50px auto;
    max-width: 600px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

/* Already voted message styling */
.already-voted-message {
    color: #dc3545;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 10px 0 0 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .voting-poll-section {
        padding: 15px;
    }
    
    .voting-poll-title {
        font-size: 1.2rem;
    }
    
    .voting-candidate-option {
        padding: 12px;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px;
    }

    .result-candidate {
        text-align: center;
        margin-left: 0;
    }

    .already-voted-section {
        padding: 20px;
        margin: 15px 0;
    }

    .already-voted-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }

    .already-voted-title {
        font-size: 1.5rem;
    }

    .already-voted-message {
        font-size: 1.1rem;
    }

    .vote-count-display {
        font-size: 1.3rem;
        padding: 15px 20px;
    }

    .position-header {
        font-size: 1.1rem;
        padding: 12px 15px;
    }

    .no-ongoing-poll {
        padding: 30px 20px;
        font-size: 1.1rem;
    }

    .no-ongoing-poll-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
}