/* ==========================================================================
   Mattress Palace Trading — Cart System Styles (White Light Theme)
   All colors match the clean white European design system in style.css
   ========================================================================== */

/* ── Cart Icon Button (in nav) ───────────────────────────────────────────── */
.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px !important;
  border: 1px solid #243025;
  background: #243025;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.cart-btn:hover {
  background: #1A241B;
  border-color: #1A241B;
  transform: none;
}

.cart-btn i,
.cart-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2;
  display: block;
}

/* ── Cart Badge ──────────────────────────────────────────────────────────── */
.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px !important;
  background: #9C7C5A;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid #FFFFFF;
  box-shadow: none;
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 10;
}

.cart-badge.visible {
  transform: scale(1);
}

.cart-badge.bump {
  animation: badge-bump 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ── Cart Overlay ────────────────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 24, 29, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ── Cart Drawer ─────────────────────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-left: 1px solid #E4E1DC;
  border-radius: 0 !important;
  box-shadow: -8px 0 48px rgba(22, 24, 29, 0.14);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.cart-drawer.open {
  transform: translateX(0);
}

/* ── Cart Header ─────────────────────────────────────────────────────────── */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 1.5rem 1.2rem;
  border-bottom: 1px solid #E4E1DC;
  flex-shrink: 0;
  background: #FAFAFA;
}

.cart-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cart-header-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 6px !important;
  background: #F5F0EA;
  border: 1px solid #E4E1DC;
  color: #243025;
  flex-shrink: 0;
}

.cart-header-icon i {
  width: 1.1rem;
  height: 1.1rem;
}

.cart-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: #16181D;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

.cart-header-count {
  font-size: 0.8rem;
  color: #5E6470;
  margin-top: 0.15rem;
}

/* Close button */
.cart-close-btn {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 6px !important;
  border: 1px solid #E4E1DC;
  background: #FFFFFF;
  color: #5E6470;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.cart-close-btn:hover {
  border-color: #243025;
  color: #16181D;
}

.cart-close-btn i {
  width: 1rem;
  height: 1rem;
}

/* ── Cart Items Scroll Area ──────────────────────────────────────────────── */
.cart-items-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-items-wrap::-webkit-scrollbar {
  width: 4px;
}

.cart-items-wrap::-webkit-scrollbar-track {
  background: #FAFAFA;
}

.cart-items-wrap::-webkit-scrollbar-thumb {
  background: #E4E1DC;
  border-radius: 2px;
}

/* Empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 3.5rem 2rem;
  text-align: center;
  color: #5E6470;
}

.cart-empty-icon {
  display: grid;
  place-items: center;
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 16px !important;
  background: linear-gradient(150deg, #F5F0EA 0%, #EFE7DB 100%);
  border: 1px solid #E4E1DC;
  color: #9C7C5A;
  margin-bottom: 0.75rem;
  box-shadow: 0 6px 18px rgba(156, 124, 90, 0.18);
}

.cart-empty-icon i {
  width: 2rem;
  height: 2rem;
  stroke-width: 1.6;
}

.cart-empty h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #16181D;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  margin: 0;
}

.cart-empty p {
  font-size: 0.9rem;
  color: #5E6470;
  line-height: 1.6;
  max-width: 24rem;
  margin: 0.35rem 0 1.5rem;
}

.cart-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--grad-red);
  color: #FFFFFF;
  border: none;
  border-radius: 6px !important;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.cart-empty-cta:hover {
  background: var(--grad-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(190, 17, 27, 0.22);
}

.cart-empty-cta i {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s;
}

.cart-empty-cta:hover i {
  transform: translateX(-3px);
}

/* ── Individual Cart Item — matches site's white/green/tan theme ────────── */
.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #FAFAFA;
  border: 1px solid #E4E1DC;
  border-radius: 6px !important;
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(22, 24, 29, 0.05));
  transition: border-color 0.2s, transform 0.2s;
}

.cart-item:hover {
  border-color: #9C7C5A;
  transform: translateY(-1px);
}

.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 6px !important;
  object-fit: cover;
  border: 1px solid #E4E1DC;
  flex-shrink: 0;
  background: #F7F5F2;
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #16181D;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9C7C5A;
  margin-top: 0.3rem;
}

.cart-item-price .unit-price {
  color: #9C7C5A;
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.65rem;
}

.cart-qty-btn {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  line-height: 1;
  border-radius: 4px !important;
  border: 1px solid #E4E1DC;
  background: #FFFFFF;
  color: #16181D;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cart-qty-btn:hover {
  background: #243025;
  color: #FFFFFF;
  border-color: #243025;
}

.cart-qty-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: #16181D;
  min-width: 1.25rem;
  text-align: center;
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  flex-shrink: 0;
}

.cart-item-total {
  font-size: 0.95rem;
  font-weight: 800;
  color: #243025;
}

.cart-remove-btn {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 4px !important;
  border: 1px solid transparent;
  background: transparent;
  color: #5E6470;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cart-remove-btn:hover {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FCA5A5;
}

.cart-remove-btn i {
  width: 0.95rem;
  height: 0.95rem;
}

/* ── Cart Footer ─────────────────────────────────────────────────────────── */
.cart-footer {
  border-top: 1px solid #E4E1DC;
  padding: 1.4rem 1.5rem;
  background: #FAFAFA;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cart-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.cart-summary-label {
  color: #5E6470;
  font-weight: 500;
}

.cart-summary-value {
  font-weight: 700;
  color: #16181D;
}

.cart-summary-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid #E4E1DC;
}

.cart-summary-total-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #16181D;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cart-summary-total-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #243025;
}

/* ── Cart Buy Button ─────────────────────────────────────────────────────── */
.cart-buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1rem;
  background: #243025;
  color: #FFFFFF;
  border: none;
  border-radius: 6px !important;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  will-change: transform;
}

.cart-buy-btn:hover {
  background: #1A241B;
  transform: translateY(-1px);
}

.cart-buy-btn i {
  width: 1rem;
  height: 1rem;
}

/* ── Cart notification toast ─────────────────────────────────────────────── */
.cart-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #243025;
  color: #FFFFFF;
  padding: 0.85rem 1.25rem;
  border-radius: 6px !important;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(22, 24, 29, 0.2);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 100001;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.cart-toast i {
  width: 1rem;
  height: 1rem;
  color: #9C7C5A;
}