/* Modern Cart Styles - Inspired by test.html */

:root {
  --card: #fff;
  --border: #ececec;
  --muted: #6b7280;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  --radius: 1rem;
}

/* Breadcrumb Styling */
.crumb {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

/* Cart Wrapper */
.cart-wrap {
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.cart-wrap .table-responsive {
  overflow-x: visible;
}

/* Cart Table Styling */
.cart-table {
  table-layout: fixed;
  width: 100%;
}

.cart-table thead th {
  border: 0;
  background: #111;
  color: #fff;
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-table td,
.cart-table th {
  vertical-align: middle;
  padding: 0.75rem 0.5rem;
  word-wrap: break-word;
  overflow: hidden;
}

/* Product name column - allow wrapping but limit height */
.cart-table td:first-child {
  max-width: 250px;
  min-width: 200px;
}

.cart-table td:first-child .prod-cell > div {
  min-width: 0;
  flex: 1;
}

.cart-table td:first-child .font-weight-bold {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  max-height: 2.8em;
  word-break: break-word;
}

/* Color column - truncate long text */
.cart-table th:nth-child(3),
.cart-table td[data-label="Màu"] {
  max-width: 150px;
  min-width: 120px;
}

.cart-table td[data-label="Màu"] > span {
  display: flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
}

.cart-table td[data-label="Màu"] .color-text {
  flex: 1;
  min-width: 0;
}

/* Price column */
.cart-table td[data-label="Giá"] {
  white-space: nowrap;
  text-align: right;
}

/* Size column */
.cart-table td[data-label="Size"] {
  text-align: center;
  white-space: nowrap;
}

/* Quantity column */
.cart-table td[data-label="Số lượng"] {
  text-align: center;
}

/* Total column */
.cart-table td[data-label="Tổng"] {
  text-align: right;
  white-space: nowrap;
}

/* Delete column */
.cart-table td[data-label="Xóa"] {
  text-align: center;
}

/* Product Cell with Thumbnail */
.prod-cell {
  display: flex;
  align-items: center;
}

.thumb {
  width: 64px;
  height: 64px;
  border-radius: 0.5rem;
  object-fit: cover;
  margin-right: 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
}

/* Color Dot */
.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.color-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quantity Stepper */
.qty-stepper {
  width: 120px;
}

.qty-stepper .btn {
  border: 1px solid var(--border);
}

.qty-input {
  background: #f5f6f7;
  border: 1px solid var(--border) !important;
}

/* Price Styling */
.price-now {
  font-weight: 700;
}

/* Badge Styling */
.badge-pill {
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}

/* Remove Button */
.remove-btn {
  border: 1px solid var(--border);
}

/* Summary Card */
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-card .line {
  display: flex;
  justify-content: space-between;
  margin: 0.35rem 0;
  color: var(--muted);
}

.summary-card .line.total {
  color: #111;
  font-weight: 800;
  font-size: 1.1rem;
}

/* Coupon Form */
.coupon .form-control {
  height: 48px;
  border: 1px solid var(--border);
}

.coupon .btn {
  height: 48px;
}

/* Empty Cart */
.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

/* Checkout Button Styles */
.checkout-btn {
  transition: all 0.3s ease;
  cursor: pointer;
}

.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.checkout-btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.checkout-btn-disabled:hover {
  opacity: 0.7;
}

.checkout-btn-disabled::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}

.summary-card .alert {
  border-radius: 0.5rem;
  font-size: 0.875rem;
  padding: 0.75rem;
}

.summary-card .alert-link {
  font-weight: 600;
  text-decoration: underline;
}

.summary-card .alert-link:hover {
  text-decoration: none;
}

/* Mobile Responsive - Table to Cards */
@media (max-width: 575.98px) {
  .table-responsive {
    border: 0;
  }

  table.cart-table thead {
    display: none;
  }

  table.cart-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  table.cart-table tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-top: 0;
  }

  table.cart-table tbody td[data-label="Sản phẩm"] {
    display: block;
  }

  table.cart-table tbody td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #111;
  }

  .prod-cell {
    margin-top: 0.35rem;
  }

  .cart-table td[data-label="Màu"] span {
    white-space: normal;
    word-break: break-word;
  }

  .color-text {
    white-space: normal;
    max-width: 100%;
  }
}
