:root {
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-blur: blur(12px);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --glass-border: 1px solid rgba(255, 255, 255, 0.4);
  --primary-color: #3B82F6;
  --text-dark: #1E293B;
  --text-light: #64748B;
  --bg-gradient: linear-gradient(135deg, #E2E8F0 0%, #F1F5F9 100%);
}

body {
  background: var(--bg-gradient) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
}

.cart-layout {
  display: flex;
  height: calc(100vh - 80px); /* Adjust based on header */
  margin: 20px;
  gap: 24px;
}

/* Sidebar - First Level Group (Product Types) */
.cart-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-radius: 16px;
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 24px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 12px;
}

.menu-item {
  padding: 12px 24px;
  margin: 4px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dark); /* 加深默认文字颜色 */
  font-weight: 600; /* 加粗文字 */
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.4); /* 增加默认背景透明度，提升层次 */
  border: 1px solid transparent; /* 预留边框位置 */
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--primary-color);
  transform: translateX(4px); /* 增加微交互 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.menu-item.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%); /* 使用渐变主色 */
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35); /* 增强投影 */
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: scale(1.02); /* 选中态微放大 */
}

.menu-icon {
  font-size: 18px;
}

.menu-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.menu-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.cart-search {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.cart-search-input {
  width: 300px;
}

/* Main Content Area */
.cart-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  padding-right: 8px; /* Scrollbar space */
}

/* Region Selector - Second Level Group */
.region-section {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-radius: 16px;
  border: var(--glass-border);
  padding: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.second-desc {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.region-card {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.region-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--primary-color);
}

.region-card.active {
  background: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.region-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin-bottom: 4px;
}

.region-icon-fallback {
  font-size: 24px;
  color: var(--primary-color);
}

.region-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

/* Product List */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.product-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.72) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 320px at 12% 0%, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0) 55%),
    radial-gradient(700px 260px at 100% 10%, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0) 50%);
  opacity: 0.9;
  pointer-events: none;
}

.product-card > * {
  position: relative;
  z-index: 1;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
  border-color: rgba(59, 130, 246, 0.35);
}

.product-card:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16), 0 18px 50px rgba(15, 23, 42, 0.10);
}

.product-header {
  margin-bottom: 14px;
}

.product-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-tags .tag {
  background: rgba(255, 255, 255, 0.55);
  color: rgba(15, 23, 42, 0.72);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  line-height: 1;
}

.product-tags .tag.feature {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.18);
  color: rgba(37, 99, 235, 0.95);
}

.product-tags .tag.stock {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.20);
  color: rgba(5, 150, 105, 0.95);
}

.product-tags .tag.danger {
  color: rgba(239, 68, 68, 0.95);
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.20);
}

.product-desc {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 18px;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding-top: 14px;
}

.price-box {
  display: flex;
  flex-direction: column;
}

.price-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

.currency-prefix {
  font-size: 14px;
}

.price-cycle {
  font-size: 12px;
  color: var(--text-light);
}

.buy-btn {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  border-radius: 12px !important;
  padding: 10px 18px !important;
  font-weight: 700;
  height: 40px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(59, 130, 246, 0.20);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.buy-btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(59, 130, 246, 0.26);
}

.buy-btn:active {
  transform: translateY(0);
  box-shadow: 0 10px 18px rgba(59, 130, 246, 0.20);
}

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .buy-btn {
    transition: none;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

@media (max-width: 768px) {
  .cart-layout {
    height: auto;
    margin: 12px;
    gap: 14px;
    flex-direction: column;
  }

  .cart-sidebar {
    width: 100%;
    padding: 14px 12px;
  }

  .sidebar-header {
    padding: 0 4px 10px;
    font-size: 16px;
    margin-bottom: 10px;
  }

  .sidebar-menu {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 6px;
  }

  .sidebar-menu::-webkit-scrollbar {
    height: 0;
  }

  .menu-item {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.55);
  }

  .menu-item.active {
    box-shadow: 0 10px 18px rgba(59, 130, 246, 0.22);
  }

  .cart-main {
    overflow: visible;
    padding-right: 0;
    gap: 14px;
  }

  .cart-search {
    padding: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .cart-search-input {
    width: 100%;
  }

  .cart-search .el-button {
    height: 36px;
    padding: 9px 14px;
    border-radius: 12px;
    font-weight: 700;
  }

  .region-section {
    padding: 14px;
  }

  .section-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .region-card {
    padding: 12px;
    border-radius: 14px;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .product-card {
    padding: 16px;
    border-radius: 16px;
  }

  .product-name {
    font-size: 16px;
  }

  .product-desc {
    font-size: 13px;
    margin-bottom: 14px;
    min-height: unset;
  }

  .product-footer {
    padding-top: 12px;
  }

  .buy-btn {
    width: 100%;
    height: 40px;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .empty-state {
    padding: 24px;
  }
}

@media (max-width: 360px) {
  .region-grid {
    grid-template-columns: 1fr;
  }
}
