/* ============================================
   服装目录系统 - 时尚美学版
   配色: 奶油白 + 深灰 + 玫瑰金点缀
   字体: Noto Sans SC (Google Fonts)
   ============================================ */

/* ---- 变量 ---- */
:root {
  --bg-page: #f7f5f2;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-header: rgba(255,255,255,0.92);
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #b8860b;
  --accent-hover: #a0760a;
  --accent-light: rgba(184,134,11,0.08);
  --price-color: #c0392b;
  --discount-bg: #e74c3c;
  --border-light: #f0ede8;
  --border-medium: #e5e0d8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ---- 重置 ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   顶部导航
   ============================================ */
.header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 20px;
  color: var(--accent);
}

.logo-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text-primary);
}

/* ---- 搜索栏 ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.search-field {
  position: relative;
  flex: 0 1 200px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: all 0.25s;
}

.search-field input::placeholder {
  color: var(--text-muted);
}

.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: #fff;
}

/* ---- 按钮 ---- */
.btn {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  letter-spacing: 1px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(184,134,11,0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

.btn-ghost:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- 提示横幅 ---- */
.hint-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 32px;
  font-size: 12px;
  color: var(--text-muted);
}

.hint-bar kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  margin: 0 2px;
}

/* ============================================
   主体布局
   ============================================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 32px 40px;
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  padding: 20px 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.category-tree {
  list-style: none;
}

/* 全部服装 */
.cat-all {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  color: var(--text-primary);
}

.cat-all .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-medium);
  transition: all 0.2s;
}

.cat-all:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.cat-all:hover .cat-dot {
  background: var(--accent);
}

.cat-all.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.cat-all.active .cat-dot {
  background: var(--accent);
}

/* 父分类 */
.cat-parent {
  border-left: 3px solid transparent;
}

.cat-parent.active-root {
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.cat-parent > .cat-label {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
  color: var(--text-primary);
}

.cat-parent > .cat-label:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.cat-parent > .cat-label.active {
  color: var(--accent);
  font-weight: 600;
}

.cat-toggle {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.25s;
}

.cat-parent.open > .cat-label .cat-toggle {
  transform: rotate(90deg);
}

/* 子分类列表 */
.cat-children {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.cat-parent.open .cat-children {
  max-height: 800px;
}

.cat-child {
  padding: 8px 20px 8px 36px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  position: relative;
}

.cat-child::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-medium);
  transition: all 0.2s;
}

.cat-child:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.cat-child:hover::before {
  background: var(--accent);
}

.cat-child.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
}

.cat-child.active::before {
  background: var(--accent);
  width: 6px;
  height: 6px;
}

/* ============================================
   右侧主区
   ============================================ */
.main {
  flex: 1;
  min-width: 0;
}

/* ---- 筛选信息栏 ---- */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filter-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 20px;
}

.tag-all {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.tag-result {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

/* ============================================
   商品网格
   ============================================ */
.clothing-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}

@media (max-width: 1200px) {
  .clothing-grid { grid-template-columns: repeat(4, 1fr); }
}

.mobile-cat-select {
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

@media (max-width: 992px) {
  .sidebar { display: none; }
  .mobile-cat-select { display: block !important; width: 100%; }
  .clothing-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-tags { width: 100%; }
  .filter-actions { width: 100%; display: flex; gap: 8px; }
}

@media (max-width: 700px) {
  .header-inner { padding: 0 16px; gap: 16px; }
  .container { padding: 12px 16px 32px; }
  .clothing-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hint-bar { display: none; }
  .search-field { flex: 1; }
  .search-bar .btn { padding: 0 14px; font-size: 12px; }
  .filter-actions { flex-wrap: wrap; }
}

/* ============================================
   商品卡片
   ============================================ */
.clothing-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 1px solid var(--border-light);
}

.clothing-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.clothing-card .img-wrap {
  width: 100%;
  padding-top: 120%;
  position: relative;
  background: #f5f3ef;
  overflow: hidden;
}

.clothing-card .img-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.clothing-card:hover .img-wrap img {
  transform: scale(1.08);
}

.clothing-card .img-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 40px;
}

/* 卡片的折扣角标 */
.clothing-card .card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--discount-bg);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(231,76,60,0.3);
  z-index: 2;
}

/* 库存状态小标（已从卡片移除） */

.clothing-card .card-body {
  padding: 14px 14px 16px;
}

.clothing-card .card-code {
  font-size: 12px;
  color: var(--text-muted);
  font-family: "SF Mono", "Consolas", monospace;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.clothing-card .card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
  min-height: 3em;
  transition: color 0.2s;
}

.clothing-card:hover .card-name {
  color: var(--accent);
}

/* ============================================
   空状态 & 加载
   ============================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   详情弹窗 - 导航按钮 & 头部右侧
   ============================================ */
.modal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.btn-nav {
  padding: 8px 24px;
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ============================================
   分页
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 32px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(184,134,11,0.3);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination .page-info {
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   弹窗 (Modal)
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-box::-webkit-scrollbar {
  width: 6px;
}
.modal-box::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 6px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

/* 详情布局 - 图文并排 */
.detail-layout {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.detail-image {
  flex: 0 0 auto;
  width: 360px;
  max-width: 100%;
}

.detail-image img {
  width: 100%;
  border-radius: var(--radius-md);
  background: #f5f3ef;
}

.detail-info {
  flex: 1;
  min-width: 250px;
}

.detail-info h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.detail-code {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.detail-meta-item {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 3px 12px;
  border-radius: 12px;
}

.detail-price-box {
  margin: 14px 0;
  padding: 14px 18px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.detail-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--price-color);
}

.detail-discount {
  font-size: 13px;
  color: var(--discount-bg);
  font-weight: 600;
  margin-left: 10px;
}

.detail-intro {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 12px 0;
}

/* 库存表格 */
.detail-stock-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 18px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stock-table thead {
  background: var(--bg-page);
}

.stock-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stock-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.stock-table td:last-child,
.stock-table th:last-child {
  text-align: right;
}

.stock-table tbody tr:hover {
  background: var(--accent-light);
}

.stock-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   滚动条美化
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
