/**
 * TPAD-CRS 自訂下拉選單樣式
 * Custom Select Component - 基於 Figma 設計優化
 */

/* 自訂下拉選單容器 */
.custom-select {
    position: relative;
    width: 100%;
}

/* 觸發按鈕 */
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* 展開狀態 */
.custom-select.open .custom-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #ffffff;
}

/* 已選擇非預設值 */
.custom-select.has-value .custom-select-trigger {
    border-color: #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-weight: 500;
}

/* 顯示文字 */
.custom-select-value {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 箭頭圖示 */
.custom-select-arrow {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-left: 8px;
    color: #64748b;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select.has-value .custom-select-arrow {
    color: #3b82f6;
}

/* 下拉選項列表 */
.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

/* 選項 */
.custom-select-option {
    padding: 10px 14px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    transition: background 0.1s ease;
}

.custom-select-option:hover {
    background: #f8fafc;
    color: #1e293b;
}

/* 選中的選項 */
.custom-select-option.selected {
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 500;
}

.custom-select-option.selected::before {
    content: '✓';
    margin-right: 8px;
    font-size: 12px;
}

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

/* 禁用狀態 */
.custom-select.disabled .custom-select-trigger {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

/* 滾動條樣式 */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 小尺寸變體 */
.custom-select.custom-select-sm .custom-select-trigger {
    height: 32px;
    padding: 4px 10px;
    font-size: 13px;
}

.custom-select.custom-select-sm .custom-select-option {
    padding: 8px 10px;
    font-size: 13px;
}

/* 大尺寸變體 */
.custom-select.custom-select-lg .custom-select-trigger {
    height: 48px;
    padding: 12px 16px;
    font-size: 16px;
}

.custom-select.custom-select-lg .custom-select-option {
    padding: 12px 16px;
    font-size: 16px;
}
