/* Кастомные выпадающие списки с темным фоном и светлым текстом */

/* Основные стили для кастомного выпадающего списка */
.custom-dropdown-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-dropdown-trigger {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    position: relative;
    z-index: 10;
}

.custom-dropdown-trigger:hover {
    border-color: #999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.custom-dropdown-trigger:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.custom-dropdown-trigger.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='18,15 12,9 6,15'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Кастомный выпадающий список */
.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2c3e50;
    border: 1px solid #34495e;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -1px;
}

.custom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Стили для опций */
.custom-dropdown-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #ecf0f1;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #34495e;
    position: relative;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    background: #2c3e50;
}

.custom-dropdown-option:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

.custom-dropdown-option:hover {
    background: #34495e;
    color: #fff;
    transform: translateX(5px);
}

.custom-dropdown-option.selected {
    background: #34495e;
    color: #fff;
    font-weight: 700;
    border-left: 3px solid #ecf0f1;
}

/* Специальные стили для разных типов выпадающих списков */
.currency-dropdown .custom-dropdown-trigger {
    background-color: #fff;
    border-color: #e0e0e0;
    color: #333;
    font-weight: 600;
}

.currency-dropdown .custom-dropdown-trigger:hover {
    background-color: #f8f9fa;
    border-color: #999;
}

.currency-dropdown .custom-dropdown-trigger:focus,
.currency-dropdown .custom-dropdown-trigger.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.category-dropdown .custom-dropdown-trigger {
    background-color: #fff;
    border-color: #e0e0e0;
    color: #333;
    font-weight: 500;
}

.category-dropdown .custom-dropdown-trigger:hover {
    background-color: #f8f9fa;
    border-color: #999;
}

.category-dropdown .custom-dropdown-trigger:focus,
.category-dropdown .custom-dropdown-trigger.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.search-dropdown .custom-dropdown-trigger {
    background-color: #fff;
    border-color: #e0e0e0;
    color: #333;
    font-weight: 500;
    border-radius: 25px;
    padding: 10px 35px 10px 15px;
}

.search-dropdown .custom-dropdown-trigger:hover {
    background-color: #f8f9fa;
    border-color: #999;
}

.search-dropdown .custom-dropdown-trigger:focus,
.search-dropdown .custom-dropdown-trigger.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.search-dropdown .custom-dropdown-menu {
    border-radius: 0 0 25px 25px;
}

/* Анимация появления опций */
.custom-dropdown-option {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInOption 0.3s ease forwards;
}

.custom-dropdown-option:nth-child(1) { animation-delay: 0.05s; }
.custom-dropdown-option:nth-child(2) { animation-delay: 0.1s; }
.custom-dropdown-option:nth-child(3) { animation-delay: 0.15s; }
.custom-dropdown-option:nth-child(4) { animation-delay: 0.2s; }
.custom-dropdown-option:nth-child(5) { animation-delay: 0.25s; }
.custom-dropdown-option:nth-child(6) { animation-delay: 0.3s; }
.custom-dropdown-option:nth-child(7) { animation-delay: 0.35s; }
.custom-dropdown-option:nth-child(8) { animation-delay: 0.4s; }
.custom-dropdown-option:nth-child(9) { animation-delay: 0.45s; }
.custom-dropdown-option:nth-child(10) { animation-delay: 0.5s; }
.custom-dropdown-option:nth-child(11) { animation-delay: 0.55s; }
.custom-dropdown-option:nth-child(12) { animation-delay: 0.6s; }

@keyframes slideInOption {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Анимация закрытия */
.custom-dropdown-menu.closing {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s ease;
}

.custom-dropdown-option.closing {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.1s ease;
}

/* Стили для placeholder опций */
.custom-dropdown-option.placeholder {
    color: #bdc3c7;
    font-style: italic;
    text-transform: none;
    font-weight: 400;
}

.custom-dropdown-option.placeholder:hover {
    background: #34495e;
    color: #bdc3c7;
    transform: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    .custom-dropdown-trigger {
        padding: 8px 35px 8px 12px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .search-dropdown .custom-dropdown-trigger {
        padding: 8px 30px 8px 12px;
        font-size: 13px;
        border-radius: 20px;
    }
    
    .custom-dropdown-option {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .custom-dropdown-menu {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .custom-dropdown-trigger {
        padding: 7px 30px 7px 10px;
        font-size: 12px;
    }
    
    .search-dropdown .custom-dropdown-trigger {
        padding: 6px 25px 6px 10px;
        font-size: 12px;
        border-radius: 15px;
    }
    
    .custom-dropdown-option {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .custom-dropdown-menu {
        max-height: 200px;
    }
}

/* Стили для состояний загрузки */
.custom-dropdown-wrapper.loading .custom-dropdown-trigger {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='10'%3e%3c/circle%3e%3cpath d='M12 6v6l4 2'%3e%3c/path%3e%3c/svg%3e");
    background-size: 16px;
    animation: spin 1s linear infinite;
}

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

/* Стили для ошибок валидации */
.custom-dropdown-wrapper.error .custom-dropdown-trigger {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.custom-dropdown-wrapper.error .custom-dropdown-trigger:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

/* Стили для успешной валидации */
.custom-dropdown-wrapper.success .custom-dropdown-trigger {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.custom-dropdown-wrapper.success .custom-dropdown-trigger:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

/* Дополнительные эффекты */
.custom-dropdown-trigger:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.custom-dropdown-trigger:disabled:hover {
    transform: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Стили для уменьшенной анимации */
@media (prefers-reduced-motion: reduce) {
    .custom-dropdown-trigger,
    .custom-dropdown-menu,
    .custom-dropdown-option {
        transition: none;
        animation: none;
    }
    
    .custom-dropdown-trigger:hover {
        transform: none;
    }
    
    .custom-dropdown-option:hover {
        transform: none;
    }
}
