﻿/******************************************************
 * ui/assets/css/components/search_bar.css
 ******************************************************/

/* 外层容器（定位上下文，允许溢出以显示菜单） */
.ui-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;

    width: 100%;
    max-width: 680px;
    height: 42px;

    overflow: visible;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);

    /* ⭐ 关键补充：让外层也变成圆角白底 */
    background: #fff;
    border-radius: 8px;
}

/* 表单主体 */
.ui-search-form {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    height: 100%;
    margin: 0;

    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

/* 分类下拉（左侧） */
.ui-search-category {
    flex: 0 0 auto;
    background: #f3f3f3;
    border-right: 1px solid #ddd;

    display: flex;
    align-items: center;
    padding: 0 5px;      /* 起作用的是下面这段增强样式，下面这段覆盖上面这个数值 */
    white-space: nowrap;
}

/* 分类增强样式 */
.ui-search-category-simple {
    position: relative;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 5px;      /* padding 越大 → 灰色块越宽，反之越窄 */
    box-sizing: border-box;
    z-index: 3;
}

.ui-search-category-label {
    padding: 6px 4px;
    background: transparent;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 箭头 */
.ui-search-category-label::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    margin-left: 0px;       /* 控制下拉文字与箭头的距离 */
    transform: translateY(1px);
}

/* 分类菜单 */
.ui-search-category-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 120px;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    z-index: 99999;
    border-radius: 6px;
    overflow: hidden;
}

.ui-search-category-hidden { display: none; }

.ui-search-category-item {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}
.ui-search-category-item:hover {
    background: #f5f5f5;
}

/* 输入框包裹器（关键：让清除按钮参与布局） */
.ui-search-input-wrap {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
}

/* 输入框 */
.ui-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding-left: 14px;   /* 输入框内词条距离输入框左右间距，防止贴死 */ 
    padding-right: 14px;
    border: none;
    outline: none;
    font-size: 16px;          /* ← 必须 ≥16px ，否则iOS使用输入框会拉近放大*/
	transform: scale(0.9375);     /* 视觉缩小到 15px */
	transform-origin: left center;/* 不让文字偏移 */
    color: #111;
    background: transparent;
}

.ui-search-input::placeholder {
    color: #777;
}

/* iOS 专用 Hack，点击输入框，不会放大拉近 */
@supports (-webkit-touch-callout: none) {
    .ui-search-input {
        font-size: 16px !important;
    }
}

/* 清除按钮（最终版：纯叉号，无圆底，无方框） */
.ui-search-clear {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-right: 6px;

    display: none;
    align-items: center;
    justify-content: center;

    background: #d8d8d8;   /* 浅灰圆底 */
    border-radius: 50%;
    border: none;          /* ← 关键：去掉外圈边框 */
    color: #fff;           /* 白色叉号 */
    cursor: pointer;
    padding: 0;
}

.ui-search-clear svg {
    width: 22px;   /* PC 端叉号大小 */
    height: 22px;
    stroke: currentColor;
}

.ui-search-clear.visible {
    display: flex !important;
}

/* 搜索按钮 */
.ui-search-btn {
    flex: 0 0 64px;
    width: 64px;
    border: none;
    background: #febd69;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;

    transition: background 0.15s ease;
}

.ui-search-btn:hover {
    background: #f3a847;
}

.ui-search-btn .icon {
    stroke: #333;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

/******************************************************
 * 搜索框 focus 时的 Amazon 黄色高亮效果 
 ******************************************************/
/* focus 效果 作用于外壳 */
.ui-search-bar:focus-within {
    border-color: #f90 !important;
    box-shadow: 0 0 0 3px rgba(255,153,0,0.4) !important;
    /*box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.35);用上面这个就不用这个*/
    /*transition: box-shadow 0.15s ease;用上面这个就不用这个*/
}

/* -------------focus效果代码结束---------------- */

/* 搜索建议面板 */
.ui-search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-width: 680px;

    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);

    padding: 8px 0;
    z-index: 9999;

    display: none;
}

/******************************************************
 * Mobile 适配（组件内的代码，非全局布局代码）
 ******************************************************/
/* 只针对小屏手机（很多安卓机宽度 >480，不会触发）手机端：叉号更大 */
@media (max-width: 480px) {
    .ui-search-clear svg {
        width: 15px;
        height: 15px;
    }
}
 
/* 响应式---针对所有手机端+小平板的样式 */
@media (max-width: 768px) {
    .ui-search-bar { max-width: 100%; height: 40px; }
    .ui-search-form { border-radius: 6px; }
    .ui-search-btn { width: 44px; }
	
/* ⭐ -------清除搜索组件内部的左右 padding（真正控制视觉间距的地方）--------- */

/* 输入框：内词条与搜索框左右间距。防贴死边缘 */
.portal-topbar-search .ui-search-input {
    padding-left: 14px !important;   /* ← 词条距离输入框左侧间距*/
    padding-right: 14px !important;  /* ← 词条距离输入框右侧间距 */
   }
   
/* 搜索按钮 */
.portal-topbar-search .ui-search-btn {
    padding-right: 4px !important;  /* ← 按钮距离右侧距离*/
	}
	
/* 控制“灰色块本体”的左右内边距，不控制弹出的下拉菜单尺寸 */
.portal-topbar-search .ui-search-category {
    padding-left: 5px !important;   /* ← 分类下拉内部左侧距离 */
    padding-right: 5px !important;  /* ← 分类下拉内右侧距离 */
	}	
	
	
}  /* ← 这里是 @media 的结束 */
