/* 省-市两级选择器（js/city-select.js）的样式：**下拉面板**形态。
   面板挂在 body 下，由 JS 按触发器的 rect 定位（fixed），下方空间不够时向上弹。
   类名一律带 gr-city- 前缀 —— commerce.css / marketplace-compact.css / merchant-commerce.css
   里有大量无作用域规则（不少带 !important），短通用类名会被整条接管。

   ⚠️ 两个必须带前缀的原因（改样式时别删）：
   1. commerce.css 有「body button, body [type=button]{min-height:42px; display:inline-flex; …}」
      （特异性 0,1,1）⇒ 按钮写 `.gr-city .gr-city-btn`（0,2,0），裸写 .gr-city-btn 会被压掉。
   2. 触发器是 <button type="button"> 也会命中上面那条 ⇒ 内部布局不用 justify-content
      （会被它的 center 盖掉），改成「文字 span flex:1 + ::after 箭头」，靠 flex 自动靠右。 */

/* ---------- 触发器（页面可局部覆盖高度 / 边框 / 配色，见各页的局部样式） ---------- */
.gr-city-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d8dbe0;
    border-radius: 8px;
    background: #fff;
    color: #1b1b1f;
    font-family: inherit;
    text-align: left;
    cursor: pointer
}

.gr-city-trigger.is-empty {
    color: #9a9aa5
}

.gr-city-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis
}

/* 清空按钮：只在有值时出现。用 <span role="button"> 而不是 <button> —— 触发器本身就是
   <button>，按钮套按钮是非法 HTML，浏览器会把内层元素挤到外面、结构会坏。
   它落在「文字」与「箭头」之间（::after 作为伪元素永远排最后）。
   ⚠️ 叉用两条伪元素线画，**不要**改回「×」字符：字符在 18px 圆里受字体基线影响，视觉上明显偏上
   （用户 2026-09-28 报「没有居中」）；两条线靠 left/top:50% + translate(-50%,-50%) 定位，
   几何中心与圆心必然重合，换字体也不跑偏。 */
.gr-city-trigger .gr-city-clear {
    position: relative;
    display: none;
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c8ccd3;
    cursor: pointer
}

.gr-city-trigger.has-value .gr-city-clear {
    display: block
}

.gr-city-trigger .gr-city-clear::before,
.gr-city-trigger .gr-city-clear::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 2px;
    border-radius: 1px;
    background: #fff
}

.gr-city-trigger .gr-city-clear::before {
    transform: translate(-50%, -50%) rotate(45deg)
}

.gr-city-trigger .gr-city-clear::after {
    transform: translate(-50%, -50%) rotate(-45deg)
}

.gr-city-trigger .gr-city-clear:hover {
    background: #9a9aa5
}

.gr-city-trigger .gr-city-clear:focus-visible {
    outline: 2px solid #e63939;
    outline-offset: 1px
}

.gr-city-trigger::after {
    content: '';
    flex: none;
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid #9a9aa5;
    border-bottom: 1.5px solid #9a9aa5;
    transform: rotate(45deg)
}

/* ---------- 下拉层 ---------- */
.gr-city {
    position: fixed;
    inset: 0;
    z-index: 1300
}

.gr-city[hidden] {
    display: none
}

/* 透明遮罩：只接管「点空白关闭」。这是下拉框不是模态弹窗 ⇒ 不暗化页面。 */
.gr-city-mask {
    position: absolute;
    inset: 0
}

.gr-city-panel {
    position: fixed;
    display: flex;
    flex-direction: column;
    border: 1px solid #ececf0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(17, 22, 32, .14);
    overflow: hidden;
    animation: gr-city-in .16s ease-out
}

@keyframes gr-city-in {
    from {
        opacity: 0;
        transform: translateY(-4px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.gr-city-body {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    flex: 1;
    min-height: 0
}

.gr-city-list {
    min-height: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto
}

.gr-city-provinces {
    border-right: 1px solid #f2f3f5;
    background: #fafafb
}

.gr-city-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 7px;
    color: #55585f;
    font-size: 14.5px;
    cursor: pointer
}

.gr-city-list li:hover {
    background: #f5f6f8
}

.gr-city-list li.on {
    background: #fdeded;
    color: #c5161d;
    font-weight: 600
}

.gr-city-list li.empty {
    color: #9a9aa5;
    cursor: default
}

.gr-city-list li.empty:hover {
    background: none
}

.gr-city-dot {
    flex: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid #c8ccd3;
    border-radius: 50%
}

.gr-city-list li.on .gr-city-dot {
    border-color: #e63939;
    background: #e63939;
    box-shadow: inset 0 0 0 3px #fff
}

.gr-city-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid #ececf0
}

.gr-city-count {
    flex: 1;
    min-width: 0;
    color: #9a9aa5;
    font-size: 13px
}

.gr-city .gr-city-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-height: 0;
    padding: 0 18px;
    border: 1px solid #ffc9c4;
    border-radius: 7px;
    background: #fff;
    color: #e63939;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer
}

.gr-city .gr-city-btn:hover {
    background: #fdeded
}

.gr-city .gr-city-btn.solid {
    border-color: transparent;
    background: linear-gradient(135deg, #ff6b5b, #e63939);
    color: #fff
}

.gr-city .gr-city-btn.solid:hover {
    filter: brightness(1.05)
}

.gr-city .gr-city-btn.solid:disabled {
    opacity: .5;
    cursor: not-allowed;
    filter: none
}
