/* Buttons - JD Style */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 2px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
  background: var(--jd-red);
  color: #fff;
  width: auto;
  padding: 8px 20px;
}

.btn-primary:hover { background: var(--jd-red-dark); opacity: 1; }

.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-primary.full-width { width: 100%; padding: 12px; font-size: 14px; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--jd-border);
  color: var(--jd-text);
}

.btn-outline:hover {
  border-color: var(--jd-red);
  color: var(--jd-red);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* Social Buttons */
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-white);
  width: 100%;
}

.social-btn:hover {
  border-color: #999;
}

.social-btn.apple {
  background: #000;
  color: #fff;
  border-color: #000;
}

.social-btn.apple:hover {
  background: #333;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--jd-red);
  box-shadow: 0 0 0 2px rgba(241,2,21,0.1);
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-textarea:focus {
  border-color: var(--jd-red);
  box-shadow: 0 0 0 2px rgba(241,2,21,0.1);
}

.form-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--primary);
  cursor: pointer;
}

.form-note {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-inline {
  display: flex;
  gap: 8px;
}

.form-inline .form-input {
  flex: 1;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 4px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease;
}

.modal-lg {
  max-width: 600px;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-body);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
  white-space: pre-line;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}

/* Product Card */
.product-card {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(21,101,192,0.18);
  transform: translateY(-3px);
}

.product-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: #f8f8f8;
  overflow: hidden;
}

.product-img-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .product-img-wrap img {
  transform: scale(1.04);
}

.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
  font-weight: 600;
}

.product-badge.hot { background: #ff6600; }
.product-badge.new { background: #1b7e34; }

.product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-cat-tag {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 6px;
  border-radius: 2px;
  display: inline-block;
  width: fit-content;
}

.product-name {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.price-main {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
}

.price-main .yuan { font-size: 13px; font-weight: 500; }

.price-original {
  font-size: 12px;
  color: #aaa;
  text-decoration: line-through;
  margin-left: 6px;
}

.price-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.price-hidden {
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  color: var(--text-muted);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  margin-top: 8px;
}

.price-hidden a {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.quote-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.quote-btn:hover { filter: brightness(1.05); }

.quote-btn.in-cart {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
}

.quote-btn.disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Scroll top */
.scroll-top {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 98;
  box-shadow: 0 2px 12px rgba(21,101,192,0.4);
  border: none;
  transition: all 0.2s;
}

.scroll-top.show {
  display: flex;
}

.scroll-top:hover {
  transform: translateY(-2px);
}


/* ===== Cart Button ===== */
.header-cart-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 8px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.header-cart-btn::after {
  content: attr(data-count);
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.header-cart-btn[data-count="0"]::after,
.header-cart-btn:not([data-count])::after { display: none; }
.header-cart-btn:hover { background: var(--border); }

/* ===== Cart Modal ===== */
#cartModalBody { padding: 0; min-height: 200px; }

.cart-empty {
  text-align: center; padding: 48px 24px; color: var(--text-secondary);
  font-size: 14px;
}
.cart-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

.cart-items-list { max-height: 400px; overflow-y: auto; }

.cart-item {
  display: flex; gap: 12px; padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
  width: 60px; height: 60px;
  object-fit: cover; border-radius: 6px;
  background: var(--bg-secondary); flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cart-item-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.cart-item-price { font-size: 14px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.cart-item-qty {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}
.qty-btn {
  width: 24px; height: 24px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-secondary);
  cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.qty-num { font-size: 13px; font-weight: 600; min-width: 20px; text-align: center; }
.cart-item-remove {
  background: none; border: none;
  color: var(--text-secondary); cursor: pointer;
  font-size: 18px; padding: 4px;
  flex-shrink: 0;
}
.cart-item-remove:hover { color: var(--danger); }

.cart-footer {
  padding: 16px;
  border-top: 2px solid var(--border);
  background: var(--bg-primary);
}
.cart-summary-row {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 8px;
}
.cart-summary-row.total {
  font-size: 15px; font-weight: 700;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cart-checkout-btn {
  width: 100%; margin-top: 12px;
  padding: 12px; border-radius: 8px;
  background: var(--primary); color: #fff;
  border: none; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.cart-checkout-btn:hover { background: var(--primary-dark); }
.cart-checkout-btn:disabled { background: var(--text-secondary); cursor: not-allowed; }
.cart-clear-btn {
  background: none; border: none;
  color: var(--text-secondary); font-size: 12px;
  cursor: pointer; margin-top: 8px;
}
.cart-clear-btn:hover { color: var(--danger); }

/* ===== Order Modal ===== */
#orderModalBody { padding: 0; }

.order-print-wrap {
  padding: 32px;
  background: #fff; color: #222;
  font-family: 'Plus Jakarta Sans', 'Microsoft YaHei', sans-serif;
  font-size: 13px;
}
.order-print-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}
.order-brand { font-size: 20px; font-weight: 800; color: #222; }
.order-brand span { color: var(--primary); }
.order-doc-title { font-size: 22px; font-weight: 700; color: #222; text-align: right; }
.order-doc-sub { font-size: 11px; color: #888; text-align: right; }
.order-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 24px;
}
.order-meta-block { }
.order-meta-label { font-size: 10px; font-weight: 700; color: #888; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.order-meta-value { font-size: 13px; font-weight: 600; color: #222; }
.order-items-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; margin-bottom: 20px;
}
.order-items-table th {
  background: var(--primary); color: #fff;
  padding: 8px 10px; text-align: left;
  font-weight: 600; font-size: 11px;
}
.order-items-table th:last-child { text-align: right; }
.order-items-table td {
  padding: 8px 10px; border-bottom: 1px solid #eee;
}
.order-items-table td:last-child { text-align: right; font-weight: 600; }
.order-items-table tr:nth-child(even) td { background: #fafafa; }
.order-items-table .text-center { text-align: center; }
.order-totals { margin-left: auto; width: 260px; }
.order-totals-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12px;
}
.order-totals-row.grand-total {
  font-size: 15px; font-weight: 700;
  border-top: 2px solid #222; margin-top: 4px; padding-top: 8px;
  color: var(--primary);
}
.order-note {
  margin-top: 20px; padding: 12px;
  background: #f9f9f9; border-radius: 6px;
  font-size: 11px; color: #666; line-height: 1.6;
}
.order-note strong { color: #222; }
.order-signatures {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid #eee;
}
.order-sig-block {}
.order-sig-label { font-size: 11px; font-weight: 700; color: #888; margin-bottom: 4px; }
.order-sig-line { border-top: 1px solid #222; margin-top: 32px; font-size: 11px; color: #888; }

.order-print-footer {
  margin-top: 24px; padding-top: 12px;
  border-top: 1px solid #eee;
  text-align: center; font-size: 11px; color: #aaa;
}

.order-no-items {
  text-align: center; padding: 40px; color: #888;
}

/* Print button */
.order-actions {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--bg-primary);
}
.print-btn {
  padding: 8px 20px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.print-btn:hover { background: var(--border); }

.order-content {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

@media print {
  body * { visibility: hidden; }
  .order-print-wrap, .order-print-wrap * { visibility: visible; }
  .order-print-wrap {
    position: fixed; left: 0; top: 0;
    width: 100%; padding: 24px;
    background: #fff;
  }
  .order-actions, .modal-overlay .modal-header { display: none !important; }
  .modal-overlay { background: none !important; }
  .modal, .modal-body { padding: 0 !important; margin: 0 !important; max-width: none !important; }
}

/* 客服浮标 */
.contact-float {
  position: fixed;
  right: 20px;
  bottom: 80px;
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(225, 37, 27, 0.3);
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.contact-float:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(225, 37, 27, 0.4);
}
.contact-float-icon { font-size: 18px; }

/* 客服面板 */
.contact-panel {
  position: fixed;
  right: 20px;
  bottom: 140px;
  width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
}
.contact-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.contact-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-primary);
}
.contact-panel-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.contact-panel-close:hover {
  background: var(--bg-secondary);
}
.contact-panel-body {
  padding: 12px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.contact-item:hover {
  background: var(--bg-secondary);
}
.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.contact-info { flex: 1; }
.contact-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}
.contact-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 二级分类 */
.cat-sub {
  font-size: 13px;
  background: var(--bg-secondary);
  margin: 2px 0;
}
.cat-sub:hover {
  background: var(--border);
}
.cat-toggle {
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--bg-secondary);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.cat-toggle.expanded {
  background: var(--primary);
  color: #fff;
}
