/**
 * 自定义 Box 下拉框样式
 */

/* 主容器 */
.custom-box-dropdown-wrapper {
    width: 100%;
    margin-bottom: 0.5rem;
    clear: both;
}

/* 标题（显示在触发器上方） */
.custom-box-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    padding: 0 2px;
}

.custom-box-dropdown {
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* 下拉触发器 */
.custom-box-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding:8px;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
}

.custom-box-trigger:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.custom-box-dropdown.active .custom-box-trigger {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}

/* 选中项显示区域 */
.box-selected {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.box-icon {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f3f4f6;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.box-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.box-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.box-label {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

.box-price {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
    display: none !important; /* 隐藏触发器中的价格 */
}

.box-price .woocommerce-Price-amount {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
}

/* 下拉箭头 */
.box-arrow {
    width: 20px;
    height: 20px;
    color: #6b7280;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.custom-box-dropdown.active .box-arrow {
    transform: rotate(180deg);
}

.box-arrow svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* 下拉菜单 */
.custom-box-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 350px;
    overflow: hidden;
}

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

/* 选项列表容器 */
.box-options {
    max-height: 350px;
    overflow-y: auto;
    padding: 8px;
}

/* 自定义滚动条 */
.box-options::-webkit-scrollbar {
    width: 6px;
}

.box-options::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.box-options::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.box-options::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 下拉选项 */
.box-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.box-option:hover {
    background-color: #f3f4f6;
}

.box-option.selected {
    background-color: #e5e7eb;
}

.box-option.selected .option-title {
    font-weight: 600;
}

/* 选项图片 */
.option-image {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9fafb;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
}

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

/* 选项信息 */
.option-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.option-title {
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.4;
}

.option-price {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
    display: block !important; /* 下拉菜单中显示价格 */
}

.option-price .woocommerce-Price-amount {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
}

/* 隐藏输入字段 */
.custom-box-dropdown input[type="hidden"] {
    display: none !important;
}

/* 无障碍支持 */
.custom-box-trigger:focus {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.box-option:focus {
    outline: 2px solid #111827;
    outline-offset: -2px;
}

/* 加载状态 */
.custom-box-dropdown.loading .custom-box-trigger {
    opacity: 0.6;
    pointer-events: none;
}

/* 禁用状态 */
.custom-box-dropdown.disabled .custom-box-trigger {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-box-menu.animating {
    animation: fadeIn 0.2s ease-out;
}

/* 响应式样式 */
@media (max-width: 768px) {
    .custom-box-trigger {
        padding: 10px 12px;
        min-height: 65px;
    }
    
    .box-icon {
        width: 45px;
        height: 45px;
    }
    
    .box-label {
        font-size: 15px;
    }
    
    .box-price {
        font-size: 13px;
    }
    
    .option-image {
        width: 50px;
        height: 50px;
    }
    
    .option-title {
        font-size: 14px;
    }
    
    .option-price {
        font-size: 13px;
    }
    
    .box-options {
        max-height: 300px;
    }
    
    .custom-box-menu {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .custom-box-trigger {
        padding: 8px 10px;
        min-height: 60px;
    }
    
    .box-icon {
        width: 40px;
        height: 40px;
    }
    
    .box-label {
        font-size: 14px;
    }
    
    .box-price {
        font-size: 12px;
    }
    
    .option-image {
        width: 45px;
        height: 45px;
    }
    
    .option-title {
        font-size: 13px;
    }
    
    .option-price {
        font-size: 12px;
    }
}

