/* ============================================================
   XSR Mobile Drawer — Search & Nav  v2
   ============================================================ */

/* 防止 body 滚动 */
body.xsr-drawer-open {
  overflow: hidden;
}

/* ── 抽屉容器（全屏遮罩） ── */
.xsr-mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;          /* 高于轮播图、sticky nav 一切元素 */
}
.xsr-mobile-drawer.is-open {
  display: block;
}

/* ── 背景遮罩 ── */
.xsr-drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: xsr-fade-in 0.2s ease;
  z-index: 99999;
}

/* ── 面板通用 ── */
.xsr-drawer-panel {
  position: absolute;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
}

/* ── 搜索面板：从顶部滑下 ── */
.xsr-drawer-panel--search {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  border-radius: 0 0 16px 16px;
  animation: xsr-slide-down 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 100000;
}

/* ── 导航面板：从左侧滑入，全高 ── */
.xsr-drawer-panel--nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(85vw, 320px);
  min-height: 100vh;
  height: 100%;
  border-radius: 0 16px 16px 0;
  animation: xsr-slide-in-left 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 100000;
}

/* ── 抽屉头部 ── */
.xsr-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: #fff;
}

.xsr-drawer-title {
  font-family: Inter, "Open Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.xsr-drawer-close {
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.xsr-drawer-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ── 搜索抽屉 body ── */
.xsr-drawer-panel--search .xsr-drawer-body {
  padding: 18px 18px 22px;
}

/* ── 搜索框 ── */
.xsr-mobile-search-box {
  display: flex;
  align-items: center;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
  background: #f9fafb;
}
.xsr-mobile-search-box:focus-within {
  border-color: #374151;
  background: #fff;
}
.xsr-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 13px 14px;
  font-size: 15px;
  font-family: Inter, "Open Sans", sans-serif;
  color: #111827;
  outline: none;
  min-width: 0;
}
.xsr-search-input::placeholder {
  color: #9ca3af;
}
.xsr-search-submit {
  background: #111827;
  border: none;
  color: #fff;
  padding: 0 18px;
  height: 48px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.18s;
  flex-shrink: 0;
}
.xsr-search-submit:hover {
  background: #374151;
}

/* ── 导航抽屉 body ── */
.xsr-drawer-panel--nav .xsr-drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  min-height: 0;
}

/* ── 移动端导航列表 ── */
.xsr-mobile-nav {
  list-style: none;
  margin: 0;
  padding: 8px 0 32px;
}

/* ── L1 item ── */
.xsr-mobile-nav__item {
  border-bottom: 1px solid #f3f4f6;
}
.xsr-mobile-nav__item:last-child {
  border-bottom: none;
}

.xsr-mobile-nav__row {
  display: flex;
  align-items: stretch;
}

/* L1 链接 */
.xsr-mobile-nav__link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  font-family: Inter, "Open Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  transition: background 0.15s;
  min-width: 0;
}
.xsr-mobile-nav__link:hover,
.xsr-mobile-nav__link:active {
  background: #f9fafb;
  color: #000;
  text-decoration: none;
}

.xsr-mobile-nav__icon {
  font-size: 13px;
  color: #9ca3af;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── 展开/折叠按钮 ── */
.xsr-mobile-nav__toggle {
  background: none;
  border: none;
  border-left: 1px solid #f3f4f6;
  padding: 0 16px;
  cursor: pointer;
  color: #9ca3af;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  min-height: 48px;
}
.xsr-mobile-nav__toggle:hover {
  background: #f3f4f6;
  color: #374151;
}
.xsr-mobile-nav__toggle .fa {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

/* 展开时箭头旋转 */
.xsr-mobile-nav__item--has-children.is-open > .xsr-mobile-nav__row > .xsr-mobile-nav__toggle .fa,
.xsr-mobile-nav__sub-item--has-children.is-open > .xsr-mobile-nav__row > .xsr-mobile-nav__toggle .fa {
  transform: rotate(180deg);
}

/* ── L2 子列表 ── */
.xsr-mobile-nav__sub {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f9fafb;
  /* 默认折叠 */
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 展开 */
.xsr-mobile-nav__item--has-children.is-open > .xsr-mobile-nav__sub,
.xsr-mobile-nav__sub-item--has-children.is-open > .xsr-mobile-nav__sub {
  max-height: 1200px;
}

.xsr-mobile-nav__sub-item {
  border-top: 1px solid #efefef;
}

/* L2 链接 */
.xsr-mobile-nav__sub-link {
  display: flex;
  align-items: center;
  padding: 12px 18px 12px 30px;
  font-family: Inter, "Open Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.xsr-mobile-nav__sub-link:hover,
.xsr-mobile-nav__sub-link:active {
  background: #f0f0f0;
  color: #111827;
  text-decoration: none;
}

/* L2 有子项时 sub-link 占满 row */
.xsr-mobile-nav__sub-item--has-children .xsr-mobile-nav__row {
  display: flex;
  align-items: stretch;
}
.xsr-mobile-nav__sub-item--has-children .xsr-mobile-nav__sub-link {
  flex: 1;
}

/* L3 */
.xsr-mobile-nav__sub--l3 {
  background: #f0f1f3;
}
.xsr-mobile-nav__sub-link--l3 {
  padding-left: 44px;
  font-size: 12.5px;
  color: #4b5563;
}
.xsr-mobile-nav__sub-link--l3:hover {
  background: #e8e9ec;
}

/* ── 动画 ── */
@keyframes xsr-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes xsr-slide-down {
  from { transform: translateY(-100%); opacity: 0.6; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes xsr-slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ── 桌面端隐藏抽屉 ── */
@media (min-width: 993px) {
  .xsr-mobile-drawer {
    display: none !important;
  }
}
