/* 美化下拉列表样式 */

/* 基础选择器样式 */
.custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.custom-select select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.custom-select select:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 自定义箭头 */
.custom-select::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #6c757d;
    pointer-events: none;
    transition: all 0.3s ease;
}

.custom-select:hover::after {
    border-top-color: #007bff;
}

.custom-select select:focus + .custom-select::after,
.custom-select:focus-within::after {
    border-top-color: #007bff;
    transform: translateY(-50%) rotate(180deg);
}

/* 带图标的选择器 */
.custom-select-with-icon {
    position: relative;
}

.custom-select-with-icon .select-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 1;
    pointer-events: none;
}

.custom-select-with-icon select {
    padding-left: 44px;
}

/* 不同尺寸 */
.custom-select.select-sm select {
    padding: 8px 32px 8px 12px;
    font-size: 13px;
}

.custom-select.select-sm::after {
    right: 12px;
    border-left-width: 5px;
    border-right-width: 5px;
    border-top-width: 5px;
}

.custom-select.select-lg select {
    padding: 16px 48px 16px 20px;
    font-size: 16px;
}

.custom-select.select-lg::after {
    right: 20px;
    border-left-width: 7px;
    border-right-width: 7px;
    border-top-width: 7px;
}

/* 不同颜色主题 */
.custom-select.select-primary select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.custom-select.select-success select:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.custom-select.select-warning select:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}

.custom-select.select-danger select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.custom-select.select-info select:focus {
    border-color: #17a2b8;
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

/* 禁用状态 */
.custom-select select:disabled {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.custom-select select:disabled + .custom-select::after {
    border-top-color: #adb5bd;
}

/* 错误状态 */
.custom-select.is-invalid select {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.custom-select.is-invalid::after {
    border-top-color: #dc3545;
}

/* 成功状态 */
.custom-select.is-valid select {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.custom-select.is-valid::after {
    border-top-color: #28a745;
}

/* 多选下拉框样式 */
.custom-select select[multiple] {
    height: auto;
    min-height: 120px;
    padding: 8px 16px;
}

.custom-select select[multiple]:focus {
    transform: none;
}

/* 选项样式 */
.custom-select select option {
    padding: 8px 16px;
    background: #fff;
    color: #495057;
}

.custom-select select option:hover {
    background: #f8f9fa;
}

.custom-select select option:checked {
    background: #007bff;
    color: #fff;
}

/* 响应式设计 */
@media (max-width: 576px) {
    .custom-select select {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 动画效果 */
@keyframes selectFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.custom-select select:focus {
    animation: selectFocus 0.3s ease;
}

/* 加载状态 */
.custom-select.loading::after {
    content: '';
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    right: 16px;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* 搜索型下拉框 */
.custom-select.searchable {
    position: relative;
}

.custom-select.searchable .search-input {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    border: none;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    z-index: 2;
}

.custom-select.searchable .search-input:focus {
    outline: none;
}

/* 分组选项样式 */
.custom-select select optgroup {
    font-weight: bold;
    color: #6c757d;
    background: #f8f9fa;
    font-style: normal;
}

.custom-select select optgroup option {
    font-weight: normal;
    padding-left: 24px;
    color: #495057;
    background: #fff;
}

/* 工具提示样式 */
.custom-select[data-toggle="tooltip"] {
    cursor: help;
}

/* 标签样式增强 */
.form-label-enhanced {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-label-enhanced .label-icon {
    color: #6c757d;
    font-size: 14px;
}

.form-label-enhanced .label-required {
    color: #dc3545;
    font-size: 12px;
}

/* 选择器组合样式 */
.select-group {
    display: flex;
    gap: 12px;
    align-items: end;
}

.select-group .custom-select {
    flex: 1;
}

.select-group .btn {
    white-space: nowrap;
    height: fit-content;
}
