/* ─────────────────────────────────────────────────────────────────
   IVA Cloud — Cart Drawer Styles
   ───────────────────────────────────────────────────────────────── */

/* ── Overlay ────────────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.cart-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer ─────────────────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1101;
  width: 480px;
  max-width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface, #0d0d0d);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.cart-drawer.is-open {
  transform: translateX(0);
}

@media (max-width: 520px) {
  .cart-drawer {
    width: 100vw;
    border-left: none;
  }
}

/* ── Header ─────────────────────────────────────────────────────── */
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.cart-drawer-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-on-dark, #F5F5F7);
  margin: 0;
}
.cart-drawer-title svg {
  color: var(--color-on-dark, #F5F5F7);
  flex-shrink: 0;
}
.cart-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary, #aaa);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.cart-drawer-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ── Body ───────────────────────────────────────────────────────── */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
/* Custom scrollbar */
.cart-drawer-body::-webkit-scrollbar { width: 4px; }
.cart-drawer-body::-webkit-scrollbar-track { background: transparent; }
.cart-drawer-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* ── Cart list ──────────────────────────────────────────────────── */
.cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cart-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  animation: cartItemIn 0.25s ease;
}
@keyframes cartItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cart-item-img {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-item-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255,255,255,0.2);
}
.cart-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cart-item-category {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #00c7d1);
}
.cart-item-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9); /* was var(--text-primary, #1A1A1F) — dark on dark! */
  text-decoration: none;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}
.cart-item-name:hover { color: var(--accent, #00c7d1); }
.cart-item-price {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

/* ── Qty controls ───────────────────────────────────────────────── */
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.25rem;
}
.cart-qty-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s;
  border-radius: 0;
}
.cart-qty-btn:first-child { border-radius: 6px 0 0 6px; }
.cart-qty-btn:nth-child(3) { border-radius: 0 6px 6px 0; }
.cart-qty-btn:hover { background: rgba(255,255,255,0.1); }
.cart-qty-val {
  width: 34px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  height: 30px;
  line-height: 30px;
  background: rgba(255,255,255,0.02);
}
.cart-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  margin-left: 0.5rem;
  border-radius: 6px;
  transition: color 0.18s, background 0.18s;
}
.cart-remove-btn:hover {
  color: #ff4d4d;
  background: rgba(255,77,77,0.08);
}

/* ── Empty state ────────────────────────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  gap: 0.75rem;
}
.cart-empty-icon {
  color: rgba(255,255,255,0.15);
  margin-bottom: 0.5rem;
}
.cart-empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.cart-empty-subtitle {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.45);
  margin: 0;
}
.btn-cart-shop {
  display: inline-flex;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  background: rgba(0, 199, 209, 0.12);
  border: 1px solid rgba(0, 199, 209, 0.3);
  color: var(--accent, #00c7d1);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.btn-cart-shop:hover {
  background: rgba(0, 199, 209, 0.2);
  border-color: rgba(0,102,255,0.6);
}

/* ── Loading ────────────────────────────────────────────────────── */
.cart-loading {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}
.cart-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent, #00c7d1);
  border-radius: 50%;
  animation: cartSpin 0.7s linear infinite;
}
@keyframes cartSpin {
  to { transform: rotate(360deg); }
}

/* ── Error ──────────────────────────────────────────────────────── */
.cart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
}
.cart-error p { margin: 0; font-size: 0.875rem; }

/* ── Footer ─────────────────────────────────────────────────────── */
.cart-drawer-footer {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--surface, #0d0d0d);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.cart-total-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.55);
}
.cart-total-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.btn-cart-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border-radius: 100px;
  background: var(--accent, #00c7d1);
  color: var(--bg-deep, #050507);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.22s, transform 0.15s;
  border: none;
  cursor: pointer;
}
.btn-cart-checkout:hover {
  background: #00b3bd;
  transform: translateY(-1px);
}
.btn-cart-checkout:active { transform: translateY(0); }

/* ── Navbar cart trigger ────────────────────────────────────────── */
.nav-cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.nav-cart:hover {
  background: rgba(255,255,255,0.08);
  color: var(--accent, #00c7d1);
}
.nav-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--accent, #00c7d1);
  color: var(--bg-deep, #050507);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}
/* Hide badge when count is 0 */
.nav-cart-badge[data-cart-count="0"] { display: none; }
.nav-cart-badge[data-cart-count-mobile="0"] { display: none; }

/* ── Shop card "add to cart" mini-button ────────────────────────── */
.btn-card-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 199, 209, 0.1);
  border: 1px solid rgba(0, 199, 209, 0.25);
  color: var(--accent, #00c7d1);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.btn-card-cart:hover {
  background: rgba(0, 199, 209, 0.2);
  transform: scale(1.05);
}
.btn-card-cart:active { transform: scale(0.97); }
