﻿/* EVERFORGED cart drawer + icon styles: bone base w/ dark-slab drawer for contrast */

/* Cart icon in the header: sits on bone-tinted translucent header */
.cart-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--fg-strong, #16181D);
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.cart-icon:hover { border-color: var(--water, #8B6F1E); color: var(--water, #8B6F1E); }
.cart-icon svg { width: 20px; height: 20px; }
.cart-icon .cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--water, #8B6F1E);
  color: var(--bone, #F4F1EC);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  letter-spacing: 0;
  transform: scale(0);
  transition: transform 0.15s;
}
.cart-icon .cart-badge.has-items { transform: scale(1); }

/* Overlay behind the drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }
body.cart-open { overflow: hidden; }

/* The drawer itself: bone-tinted white surface for consistency with the pages */
#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--surface, #FFFFFF);
  border-left: 1px solid var(--rule);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.22,.61,.36,1);
  box-shadow: -12px 0 32px rgba(35, 38, 45, 0.18);
  display: flex;
  flex-direction: column;
}
#cart-drawer.open { transform: translateX(0); }

.cart-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
}
.cart-head h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--fg-strong, #16181D);
}
.cart-head h2 #cartCount {
  color: var(--fg-muted, #4A525E);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 4px;
}
.cart-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg-strong, #16181D);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.cart-close:hover { border-color: var(--water, #8B6F1E); color: var(--water, #8B6F1E); }

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 24px;
}

.cart-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-muted, #4A525E);
}
.cart-empty svg { width: 44px; height: 44px; margin: 0 auto 16px; color: var(--water, #8B6F1E); opacity: 0.6; }
.cart-empty p { font-size: 15px; margin-bottom: 6px; color: var(--fg-strong, #16181D); font-weight: 600; }
.cart-empty p.hint { font-size: 13px; color: var(--fg-muted, #4A525E); font-weight: 500; }

.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
  position: relative;
}
.cart-item:last-child { border-bottom: none; }
.cart-item .ci-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #F5EEDF;
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--water, #8B6F1E);
  overflow: hidden;
}
.cart-item .ci-thumb svg { width: 24px; height: 24px; opacity: 0.55; }
.cart-item .ci-body { min-width: 0; }
.cart-item .ci-title {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg-strong, #16181D);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  transition: color 0.15s;
}
.cart-item .ci-title:hover { color: var(--water, #8B6F1E); }
.cart-item .ci-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-soft, #6B7280);
  margin-bottom: 10px;
}
.cart-item .ci-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cart-item .ci-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  background: var(--bg, #F4F1EC);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.cart-item .ci-qbtn {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  color: var(--fg-strong, #16181D);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}
.cart-item .ci-qbtn:hover { background: rgba(35, 38, 45, 0.08); color: var(--water, #8B6F1E); }
.cart-item .ci-qval {
  min-width: 22px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--fg-strong, #16181D);
}
.cart-item .ci-price {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 15px;
  color: var(--fg-strong, #16181D);
  letter-spacing: -0.01em;
}
.cart-item .ci-remove {
  position: absolute;
  top: 14px;
  right: 0;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--fg-soft, #6B7280);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.cart-item .ci-remove:hover { color: var(--water, #8B6F1E); }

.cart-foot {
  border-top: 1px solid var(--rule);
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  background: var(--surface, #FFFFFF);
}
.cart-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--fg-muted, #4A525E);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.cart-subtotal strong {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 22px;
  color: var(--fg-strong, #16181D);
  letter-spacing: -0.02em;
}
.cart-checkout {
  display: block;
  width: 100%;
  padding: 16px 22px;
  background: var(--water, #8B6F1E);
  color: var(--bone, #F4F1EC);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
}
.cart-checkout:hover { background: var(--water-hi, #A88526); color: var(--bone, #F4F1EC); }
.cart-checkout.disabled { opacity: 0.5; pointer-events: none; }
.cart-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--fg-soft, #6B7280);
  text-align: center;
  line-height: 1.5;
}
