/* Основной контейнер виджета голосования */
.voting-widget {
    background: var(--wrap-bg-color, #ffffff);
    border: 1px solid var(--border-elements-color, #e5e5e5);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-family: inherit;
    color: var(--body-text-color, #333);
}

.voting-widget.loading {
    opacity: 0.7;
    pointer-events: none;
}

.voting-widget.voted .voting-actions {
    opacity: 0.6;
}

/* Заголовок виджета */
.voting-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-elements-color, #f0f0f0);
}

.voting-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--body-text-color, #333);
    margin: 0 0 8px 0;
}

.voting-subtitle {
    font-size: 14px;
    color: var(--body-text-color, #666);
    margin: 0;
    opacity: 0.7;
}

/* Критерии голосования */
.voting-criterion {
    margin-bottom: 24px;
}

.criterion-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--body-text-color, #333);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.criterion-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--bs-color, #007bff);
    border-radius: 2px;
}

/* Опции голосования */
.voting-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.voting-option {
    position: relative;
    background: var(--wrap-bg-color, #f8f9fa);
    border: 2px solid var(--border-elements-color, #e9ecef);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    color: var(--body-text-color, #333);
}

.voting-option:hover {
    border-color: var(--bs-color, #007bff);
    background: var(--wrap-bg-color, #f0f2ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.voting-option.selected {
    border-color: var(--bs-color, #007bff);
    background: var(--bs-color, #007bff);
    color: var(--button-color-font, #ffffff);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

.voting-option.selected .vote-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--button-color-font, #ffffff);
}

/* Иконки опций */
.option-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.option-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* Счетчики голосов */
.vote-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--bs-color, #007bff);
    color: var(--button-color-font, #ffffff);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Прогресс-бары */
.progress-container {
    position: relative;
    height: 4px;
    background: var(--border-elements-color, #e9ecef);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--bs-color, #007bff);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0;
}

/* Кнопка голосования */
.voting-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-elements-color, #e5e5e5);
    text-align: center;
}

.voting-submit {
    background: var(--button-color-bg, var(--bs-color, #007bff));
    color: var(--button-color-font, #ffffff);
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    box-shadow: var(--button-box-shadow, 0 2px 8px rgba(0, 123, 255, 0.3));
    position: relative;
}

.voting-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.voting-submit:active:not(:disabled) {
    transform: translateY(0);
}

.voting-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.voting-submit:focus {
    outline: 2px solid var(--bs-color, #007bff);
    outline-offset: 2px;
}

/* Спиннер загрузки */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-elements-color, #f3f3f3);
    border-top: 2px solid var(--bs-color, #007bff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Сообщения */
.voting-message {
    margin-top: 16px;
    text-align: center;
}

.voting-success,
.voting-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.voting-success {
    background: var(--wrap-bg-color, #d4edda);
    color: var(--body-text-color, #155724);
    border: 1px solid var(--border-elements-color, #c3e6cb);
}

.voting-info {
    background: var(--wrap-bg-color, #d1ecf1);
    color: var(--body-text-color, #0c5460);
    border: 1px solid var(--border-elements-color, #bee5eb);
}

.voting-success i,
.voting-info i {
    font-size: 16px;
}

/* Общее количество голосов */
.total-votes-info {
    text-align: center;
    margin-top: 20px;
    padding: 16px;
    background: var(--wrap-bg-color, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border-elements-color, #e9ecef);
}

.total-votes-label {
    font-size: 14px;
    color: var(--body-text-color, #666);
    margin-bottom: 4px;
    opacity: 0.7;
}

.total-votes {
    font-size: 24px;
    font-weight: 700;
    color: var(--bs-color, #007bff);
}

/* Адаптивность */
@media (max-width: 768px) {
    .voting-widget {
        padding: 16px;
        margin: 16px 0;
    }
    
    .voting-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .voting-option {
        padding: 10px 12px;
    }
    
    .option-icon {
        font-size: 20px;
    }
    
    .option-label {
        font-size: 12px;
    }
    
    .voting-title {
        font-size: 18px;
    }
    
    .criterion-title {
        font-size: 15px;
    }
    
    .voting-submit {
        padding: 10px 24px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .voting-options {
        grid-template-columns: 1fr 1fr;
    }
    
    .voting-option {
        padding: 8px 10px;
    }
    
    .option-icon {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .option-label {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .voting-submit {
        padding: 8px 20px;
        font-size: 12px;
        width: 100%;
    }
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.voting-widget {
    animation: fadeInUp 0.5s ease-out;
}

.voting-option {
    animation: fadeInUp 0.3s ease-out;
}

.voting-option:nth-child(1) { animation-delay: 0.1s; }
.voting-option:nth-child(2) { animation-delay: 0.2s; }
.voting-option:nth-child(3) { animation-delay: 0.3s; }
.voting-option:nth-child(4) { animation-delay: 0.4s; }

/* Уведомления */
.voting-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

.voting-notification--success {
    background: var(--wrap-bg-color, #d4edda);
    color: var(--body-text-color, #155724);
    border: 1px solid var(--border-elements-color, #c3e6cb);
}

.voting-notification--error {
    background: var(--wrap-bg-color, #f8d7da);
    color: var(--body-text-color, #721c24);
    border: 1px solid var(--border-elements-color, #f5c6cb);
}

.voting-notification--warning {
    background: var(--wrap-bg-color, #fff3cd);
    color: var(--body-text-color, #856404);
    border: 1px solid var(--border-elements-color, #ffeaa7);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Темная тема (если поддерживается) */
.dark-theme .voting-widget {
    background: var(--wrap-bg-color, #2d3748);
    border-color: var(--border-elements-color, #4a5568);
    color: var(--body-text-color, #e2e8f0);
}

.dark-theme .voting-title,
.dark-theme .criterion-title {
    color: var(--body-text-color, #e2e8f0);
}

.dark-theme .voting-subtitle {
    color: var(--body-text-color, #a0aec0);
    opacity: 0.7;
}

.dark-theme .voting-option {
    background: var(--wrap-bg-color, #4a5568);
    border-color: var(--border-elements-color, #718096);
    color: var(--body-text-color, #e2e8f0);
}

.dark-theme .voting-option:hover {
    background: var(--wrap-bg-color, #2d3748);
    border-color: var(--bs-color, #007bff);
}

.dark-theme .criterion-title::before {
    background: var(--bs-color, #007bff);
}

.dark-theme .voting-header {
    border-bottom-color: var(--border-elements-color, #4a5568);
}

.dark-theme .voting-actions {
    border-top-color: var(--border-elements-color, #4a5568);
}

.dark-theme .total-votes-info {
    background: var(--wrap-bg-color, #4a5568);
    border-color: var(--border-elements-color, #718096);
}

/* Интеграция с темой candyshop */
.product-voting.-sk-col {
    flex: 1;
    min-width: 300px;
}

.product-voting .product-content__head h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--body-text-color, #333);
    margin: 0 0 16px 0;
}

.product-voting .product-content__body {
    padding: 0;
}

/* Стили для интеграции с существующим дизайном */
.voting-widget {
    border-radius: var(--border-radius, 12px);
    box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, 0.05));
}

.voting-option {
    border-radius: var(--border-radius, 8px);
}

.voting-submit {
    border-radius: var(--border-radius, 25px);
}

/* Дополнительные стили для лучшей интеграции */
.voting-criterion:last-child {
    margin-bottom: 0;
}

.voting-option:focus {
    outline: 2px solid var(--bs-color, #007bff);
    outline-offset: 2px;
}

/* Стили для состояний загрузки */
.voting-widget.loading .voting-option {
    pointer-events: none;
    opacity: 0.6;
}

.voting-widget.loading .voting-submit {
    pointer-events: none;
    opacity: 0.6;
}

/* Стили для успешного голосования */
.voting-widget.voted .voting-option {
    pointer-events: none;
}

.voting-widget.voted .voting-option.selected {
    background: var(--bs-color, #007bff);
    color: var(--button-color-font, #ffffff);
}

/* Адаптация для мобильных устройств */
@media (max-width: 1024px) {
    .product-voting.-sk-col {
        min-width: 100%;
        margin-top: 20px;
    }
    
    .voting-options {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .voting-option {
        padding: 8px 10px;
    }
    
    .option-icon {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .option-label {
        font-size: 11px;
        margin-bottom: 6px;
    }
}
