/* ===== Header Cart Dropdown ===== */

.header-cart-dropdown {
  position: relative;
}

.header-cart-toggle {
  background-color: #2d3748 !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: var(--border-radius-md);
  white-space: nowrap;
  box-shadow: none !important;
}

.header-cart-toggle:hover,
.header-cart-toggle:focus,
.header-cart-toggle.show {
  background-color: #1a202c !important;
  color: #ffffff !important;
}

.header-cart-toggle::after {
  margin-left: 0.5rem;
}

#cart .header-cart-menu {
  width: 400px;
  max-width: calc(100vw - 24px);
  padding: 0;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-lg);
  overflow: hidden;
}

.header-cart-items {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.header-cart-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 72px 32px;
  gap: 0.35rem 0.65rem;
  align-items: start;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
}

.header-cart-item:last-child {
  border-bottom: none;
}

.header-cart-item-thumb img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
  border: 1px solid #e2e8f0;
  display: block;
}

.header-cart-item-info {
  min-width: 0;
}

.header-cart-item-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  color: #1a202c;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  text-decoration: none;
  margin-bottom: 0.15rem;
}

.header-cart-item-name:hover {
  color: var(--brand-primary);
}

.header-cart-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.header-cart-item-meta small {
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-cart-item-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  padding-top: 0.1rem;
}

.header-cart-item-qty {
  color: #64748b;
  font-size: 0.75rem;
  white-space: nowrap;
}

.header-cart-item-total {
  color: #1a202c;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.header-cart-item-remove {
  display: flex;
  justify-content: center;
  padding-top: 0.1rem;
}

.header-cart-item-remove .btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}

.header-cart-summary {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 0.65rem 0.85rem;
}

.header-cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
  color: #334155;
}

.header-cart-summary-row.is-grand-total {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a202c;
  padding-top: 0.35rem;
  margin-top: 0.15rem;
  border-top: 1px dashed #cbd5e1;
}

.header-cart-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.header-cart-actions .btn {
  min-width: 110px;
  min-height: 38px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.header-cart-actions .btn-light {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #1a202c !important;
}

.header-cart-actions .btn-light:hover,
.header-cart-actions .btn-light:focus,
.header-cart-actions .btn-light:active {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
  color: #1a202c !important;
}

.header-cart-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

@media (max-width: 575.98px) {
  #cart .header-cart-menu {
    width: calc(100vw - 24px);
  }

  .header-cart-item {
    grid-template-columns: 48px minmax(0, 1fr) 64px 28px;
    padding: 0.55rem 0.65rem;
  }

  .header-cart-item-thumb img {
    width: 48px;
    height: 48px;
  }

  .header-cart-actions {
    flex-direction: column;
  }

  .header-cart-actions .btn {
    width: 100%;
  }
}
