:root {
  --navy:#1f2937;
  --brand:#b45309;
  --brand-hi:#d97706;
  --bg:#faf7f2;
  --surface:#ffffff;
  --text-primary:#1f2937;
  --text-secondary:#374151;
  --text-muted:#6b7280;
  --border:#d1d5db;
  --warm-gray:#f3f4f6;
  --radius:10px;
}

/* ============================================
   研啡购物车样式
   ============================================ */

/* 购物车图标按钮 */
.cart-icon-btn {
  position: relative;
  font-size: 20px;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
}
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  background: #D0000B;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(208,0,11,0.3);
}

/* 购物车遮罩 */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.cart-overlay.show { opacity: 1; visibility: visible; }

/* 购物车抽屉 */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  z-index: 2001;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
}
.cart-drawer.open { right: 0; }

/* ===== Header ===== */
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-header-left h3 { font-size: 18px; margin: 0; }
.cart-count-label {
  font-size: 12px;
  color: var(--text-muted);
}
.cart-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cart-clear-btn {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.cart-clear-btn:hover {
  color: #e74c3c;
  background: #fef2f2;
}
.cart-drawer-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.cart-drawer-close:hover { color: var(--text-primary); background: var(--warm-gray); }

/* ===== Body ===== */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* 空购物车 */
.cart-empty {
  text-align: center;
  padding: 80px 0 60px;
}
.cart-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.cart-empty-text {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.cart-empty-btn {
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.cart-empty-btn:hover {
  background: var(--brand);
  color: #fff;
}

/* ===== 商品卡片 ===== */
.cart-item-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  transition: box-shadow 0.2s;
}
.cart-item-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.cart-item-card:last-child { margin-bottom: 0; }

.cart-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

/* 价格行 */
.cart-item-price {
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.price-original { text-decoration: line-through; color: var(--text-muted); font-size: 12px; font-weight: 400; margin-right: 4px; }
.price-final { color: var(--brand); font-weight: 700; }
.deduct-note-inline { font-size: 11px; color: var(--brand); font-weight: 500; margin-left: 4px; }

/* 抵扣说明 */
.cart-item-deduct {
  font-size: 11px;
  color: var(--brand);
  margin-top: 4px;
  padding-left: 4px;
}

/* 移除按钮 */
.cart-item-remove {
  background: none;
  border: none;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
}
.cart-item-remove:hover { color: #e74c3c; background: #fef2f2; }

/* ===== Footer ===== */
.cart-drawer-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cart-total-amount { font-size: 24px; font-weight: 700; color: var(--brand); }
.cart-discount {
  font-size: 12px;
  color: var(--brand);
  text-align: right;
  margin-bottom: 16px;
}
.cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.cart-checkout-btn:hover { background: var(--brand-dark); transform: translateY(-1px); }

/* 加入购物车提示 */
.cart-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.cart-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 子文件加入购物车按钮 */
.btn-buy-single {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  padding: 4px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}
.btn-buy-single:hover { background: var(--brand); color: #fff; }
.btn-buy-single.in-cart {
  background: var(--brand-light) !important;
  color: var(--brand) !important;
  border-color: var(--brand) !important;
  cursor: default;
}

/* 手机端购物车 */
@media (max-width: 480px) {
  #cart-drawer { width: 100vw; max-width: 100vw; right: -100vw; }
  #cart-drawer.open { right: 0; }
  .cart-item-card { padding: 10px 12px; }
  .cart-item-name { font-size: 13px; }
  .cart-drawer-body { padding: 12px 16px; }
  .cart-drawer-header { padding: 16px 20px; }
  .cart-drawer-footer { padding: 12px 20px 20px; }
  .checkout-page { padding: 80px 0 24px; }
  .order-summary { padding: 20px; }
  .payment-section { padding: 20px; }
}

/* ========== 登录弹窗 ========== */
.login-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); z-index: 9999;
  display: none; align-items: center; justify-content: center;
}
.login-overlay.show { display: flex; }

.login-modal {
  background: #fff; border-radius: 16px; padding: 36px 32px 28px;
  width: 400px; max-width: 92vw; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: loginFadeIn .25s ease;
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-close {
  position: absolute; top: 12px; right: 16px;
  font-size: 22px; cursor: pointer; color: var(--text-muted);
  line-height: 1; background: none; border: none;
}
.login-close:hover { color: var(--text-primary); }

.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.login-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.login-tab {
  padding: 10px 20px; font-size: 14px; cursor: pointer;
  border: none; background: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .2s;
}
.login-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.login-tab:hover { color: var(--text-primary); }


.login-input-group { margin-bottom: 14px; }
.login-input-group label {
  display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px;
}
.login-input-group input {
  width: 100%; padding: 11px 14px; font-size: 15px;
  background:#fff; color:var(--text-primary);
  border:1.5px solid var(--border); border-radius:8px; outline:none;
  transition:border-color .2s; box-sizing:border-box;
}
.login-input-group input:focus { border-color: var(--brand); }

.login-code-row { display: flex; gap: 10px; }
.login-code-row input { flex: 1; }
.send-code-btn {
  flex-shrink: 0; padding: 10px 16px; font-size: 13px; font-weight:600;
  background: var(--warm-gray); color: var(--brand);
  border: 1.5px solid var(--border); border-radius: 8px;
  cursor: pointer; white-space: nowrap; transition: all .2s;
}
.send-code-btn:disabled { opacity: .5; cursor: not-allowed; }
.send-code-btn:hover:not(:disabled) { background: var(--border); }

.login-submit {
  width: 100%; padding: 13px; font-size: 16px; font-weight: 700;
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  cursor: pointer; margin-top: 14px; transition: all .2s;
}
.login-submit:hover { opacity: .9; }
.login-submit:disabled { opacity: .5; cursor: not-allowed; }

.login-footer {
  text-align: center; margin-top: 16px;
  font-size: 12px; color: var(--text-muted);
}

/* 登录后导航栏 - 下拉菜单 */
#login-nav-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.login-nav-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .2s;
  user-select: none;
}

.login-nav-wrapper:hover {
  background: var(--warm-gray);
}

.login-nav-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.login-nav-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .2s;
}

.login-nav-wrapper.open .login-nav-arrow {
  transform: rotate(180deg);
}

/* 下拉菜单 */
.login-nav-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.login-nav-dropdown.show {
  display: block;
  animation: ddFadeIn .15s ease;
}

@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .15s;
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--warm-gray);
  color: var(--text-primary);
}

.dropdown-item.dropdown-logout:hover {
  color: #e74c3c;
  background: #fef2f2;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* 已发送标签 */
.login-sent-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--brand);
  font-weight: 500;
  white-space: nowrap;
  padding: 0 0 0 8px;
  animation: sentFadeIn .3s ease;
}
@keyframes sentFadeIn {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 验证码提示文字 */
.login-code-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
  display: none;
}

/* 登录弹窗输入框容器 */
.login-input-group .input-with-label {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-group .input-with-label input {
  flex: 1;
}


/* 手机号tab禁用状态 */
.login-tab.disabled {
  color: var(--text-muted) !important;
  cursor: not-allowed;
  opacity: .6;
}
.login-tab.disabled:hover {
  border-bottom-color: transparent !important;
}
.coming-soon {
  font-size: 10px;
  color: var(--brand);
  background: var(--brand-light);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 3px;
  font-weight: 400;
  vertical-align: middle;
}