/* ============================
   购物车 & 报价单样式
   ============================ */

/* Cart page layout */
.cart-page { padding: 40px 0 80px; }
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.cart-main { display: flex; flex-direction: column; gap: 16px; }
.cart-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.cart-section-title {
  font-size: 1.05rem; font-weight: 700;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
#cart-items-count {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon { font-size: 5rem; opacity: 0.4; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-light); }
.empty-state a { font-weight: 600; }

/* Cart item row */
.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-image {
  width: 80px; height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-muted);
}
.cart-item-image img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { min-width: 0; }
.cart-item-name {
  font-size: 0.95rem; font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-price { color: var(--text-light); font-size: 0.85rem; }
.cart-days-locked {
  font-size: 0.78rem; color: var(--text-light);
  background: var(--bg-muted);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Date picker */
.date-picker-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.date-inputs {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}
.date-inputs .form-group { flex: 1; }
.date-inputs input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.date-inputs input[type="date"]:focus { border-color: var(--primary); }
.date-arrow {
  font-size: 1.5rem;
  color: var(--primary);
  padding-bottom: 10px;
}
.date-info {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
}
.date-info-empty { color: var(--text-light); }
.date-info-success { color: var(--success); }
.date-info-success strong { color: var(--text); }
.date-error {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 8px;
}
.generate-hint {
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}
.btn:disabled { cursor: not-allowed; }
.summary-date-text { font-size: 0.85rem; color: var(--text-mid); }
.cart-item-actions {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px;
}
.cart-item-subtotal {
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
}
.cart-item-remove {
  width: 28px; height: 28px;
  background: transparent;
  color: var(--text-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.cart-item-remove:hover { background: #fee2e2; color: #dc2626; }

/* Discount cards */
.discount-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.discount-card {
  position: relative;
  display: block;
  padding: 18px 12px;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.discount-card input { position: absolute; opacity: 0; pointer-events: none; }
.discount-card:hover { border-color: var(--primary-light); }
.discount-card:has(input:checked) {
  background: var(--primary-bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.discount-name { font-weight: 700; margin-bottom: 4px; font-size: 0.95rem; }
.discount-rate {
  font-size: 1.4rem; font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.discount-desc { color: var(--text-light); font-size: 0.8rem; }

/* Form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 0.85rem; font-weight: 600; color: var(--text-mid);
}
.form-group input, .form-group textarea {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }

/* Summary card */
.cart-aside { position: sticky; top: calc(var(--header-h) + 16px); }
.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.summary-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--text-mid);
}
.summary-row.total {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}
.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.discount-amount { color: var(--success); }
.summary-card .btn { margin-top: 12px; }
.btn-clear {
  background: transparent;
  color: var(--text-light);
  margin-top: 4px !important;
}
.btn-clear:hover { background: var(--bg-muted); color: var(--text); }

/* Modal */
.modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: var(--bg-muted);
  color: var(--text-mid);
  border-radius: 50%;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .cart-layout { grid-template-columns: 1fr; }
  .cart-aside { position: static; }
}
@media (max-width: 600px) {
  .discount-cards { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .cart-item {
    grid-template-columns: 60px 1fr;
    grid-template-areas: "img info" "actions actions";
  }
  .cart-item-image { grid-area: img; width: 60px; height: 60px; }
  .cart-item-info { grid-area: info; }
  .cart-item-actions { grid-area: actions; flex-direction: row; justify-content: space-between; }
}
