/* أنماط عامة */
.voting-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* أنماط نتائج التصويت */
.results-container {
    margin-top: 40px;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-container h3 {
    margin-top: 0;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    font-size: 24px;
    position: relative;
    padding-bottom: 10px;
}

.results-container h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #4CAF50, #2196F3);
    border-radius: 3px;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
}

.result-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.result-image {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-info h4 {
    margin: 0 0 5px;
    color: #2c3e50;
    font-size: 16px;
}

.result-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vote-count {
    font-weight: bold;
    color: #4CAF50;
    font-size: 14px;
}

.vote-percentage {
    color: #7f8c8d;
    font-size: 13px;
}

.progress-bar {
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: bold;
    font-size: 11px;
    transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
    width: 0%; /* Start from 0 for animation */
}

/* ألوان شرائط التقدم */
.progress-fill.high-votes {
    background: linear-gradient(90deg, #4CAF50, #2E7D32);
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
}

.progress-fill.medium-votes {
    background: linear-gradient(90deg, #FFC107, #FF9800);
    box-shadow: 0 2px 5px rgba(255, 193, 7, 0.3);
}

.progress-fill.low-votes {
    background: linear-gradient(90deg, #F44336, #D32F2F);
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

.percentage-text {
    font-size: 11px;
    font-weight: bold;
}

.percentage-text.outside {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
}

.total-votes {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 16px;
    color: #2c3e50;
}

.total-votes strong {
    color: #4CAF50;
}

/* تجاوب للهواتف - هذا هو التعديل الرئيسي */
@media screen and (max-width: 768px) {
    .results-list {
        grid-template-columns: repeat(2, 1fr); /* عرض عنصرين في السطر */
        gap: 15px;
    }
    
    .result-header {
        flex-direction: column;
        text-align: center;
    }
    
    .result-image {
        margin-right: 0;
        margin-bottom: 10px;
        width: 50px;
        height: 50px;
    }
    
    .result-info h4 {
        font-size: 14px;
    }
    
    .result-stats {
        justify-content: center;
    }
    
    .vote-count,
    .vote-percentage {
        font-size: 12px;
    }
    
    .progress-bar {
        height: 16px;
    }
}

@media screen and (max-width: 480px) {
    .results-list {
        grid-template-columns: repeat(2, 1fr); /* استمرار عرض عنصرين في السطر */
        gap: 10px;
    }
    
    .results-container {
        padding: 15px;
    }
    
    .result-item {
        padding: 10px;
    }
    
    .result-info h4 {
        font-size: 12px;
    }
    
    .vote-count,
    .vote-percentage {
        font-size: 11px;
    }
}

/* أنماط إضافية للواجهة الأمامية */
.voting-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.voting-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media screen and (max-width: 768px) {
    .voting-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 480px) {
    .voting-items {
        grid-template-columns: 1fr;
    }
}

.voting-item {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.voting-item:hover {
    border-color: #4CAF50;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.voting-item.selected {
    border-color: #4CAF50;
    background-color: #f0fff0;
    position: relative;
}

.voting-item.selected::after {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #4CAF50;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.voting-item img {
    max-width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.voting-form {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #4CAF50;
    outline: none;
}

.btn-vote {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-vote:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.vote-success-animation {
    text-align: center;
    padding: 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* رسائل الخطأ */
.voting-error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: bold;
}

.voting-success-message {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: bold;
}
