/* ============================================================
   Tundrex Custom Cart System
   cart.css — Slide-out cart drawer + Add to Cart button styles
   ============================================================ */

/* ─── Cart Overlay ─────────────────────────────────────────── */
.tundrex-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.tundrex-cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── Cart Drawer ───────────────────────────────────────────── */
.tundrex-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: #0d1f0d;
  border-left: 1px solid rgba(90, 158, 56, 0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  font-family: 'DM Sans', sans-serif;
}
.tundrex-cart-drawer.open {
  transform: translateX(0);
}

/* ─── Cart Header ───────────────────────────────────────────── */
.tundrex-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(90, 158, 56, 0.2);
  flex-shrink: 0;
}
.tundrex-cart-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 0.01em;
}
.tundrex-cart-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.tundrex-cart-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.tundrex-cart-close svg {
  display: block;
}

/* ─── Cart Items ────────────────────────────────────────────── */
.tundrex-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 158, 56, 0.3) transparent;
}
.tundrex-cart-items::-webkit-scrollbar {
  width: 4px;
}
.tundrex-cart-items::-webkit-scrollbar-thumb {
  background: rgba(90, 158, 56, 0.3);
  border-radius: 4px;
}

/* ─── Empty State ───────────────────────────────────────────── */
.tundrex-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  padding: 40px 24px;
}
.tundrex-cart-empty svg {
  margin-bottom: 16px;
  opacity: 0.4;
}
.tundrex-cart-empty p {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.6);
}
.tundrex-cart-empty span {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.35);
}

/* ─── Cart Item Row ─────────────────────────────────────────── */
.tundrex-cart-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid rgba(90, 158, 56, 0.12);
}
.tundrex-cart-item:last-child {
  border-bottom: none;
}
.tundrex-cart-item-img {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(90, 158, 56, 0.2);
  padding: 6px;
}
.tundrex-cart-item-info {
  flex: 1;
  min-width: 0;
}
.tundrex-cart-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tundrex-cart-item-price {
  font-size: 0.85rem;
  color: #7dc455;
  font-weight: 600;
  margin: 0 0 12px;
}
.tundrex-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
}
.tundrex-cart-qty-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(90, 158, 56, 0.25);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.tundrex-cart-qty-btn:hover {
  background: rgba(90, 158, 56, 0.18);
  border-color: rgba(90, 158, 56, 0.5);
}
.tundrex-cart-qty-num {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  min-width: 32px;
  text-align: center;
}
.tundrex-cart-item-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
.tundrex-cart-item-remove:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

/* ─── Cart Footer ───────────────────────────────────────────── */
.tundrex-cart-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(90, 158, 56, 0.2);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}
.tundrex-cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.tundrex-cart-subtotal-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}
.tundrex-cart-subtotal-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}
.tundrex-cart-checkout-btn {
  width: 100%;
  padding: 15px 24px;
  background: #649642;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.tundrex-cart-checkout-btn:hover {
  background: #5a873b;
}
.tundrex-cart-checkout-btn:active {
  transform: scale(0.98);
}
.tundrex-cart-checkout-btn:disabled {
  background: #3a5a24;
  cursor: not-allowed;
  opacity: 0.7;
}
.tundrex-cart-checkout-btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tundrex-spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes tundrex-spin {
  to { transform: rotate(360deg); }
}

/* ─── Cart Icon in Navbar ───────────────────────────────────── */
.tundrex-cart-nav-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
.tundrex-cart-nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.tundrex-cart-nav-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}
.tundrex-cart-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  min-width: 18px;
  height: 18px;
  background: #649642;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
}
.tundrex-cart-badge.hidden {
  opacity: 0;
  transform: scale(0);
}

/* ─── Add to Cart Button ────────────────────────────────────── */
.btn-add-to-cart {
  display: block;
  width: 100%;
  padding: 16px 32px;
  background: #649642;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  font-family: 'DM Sans', sans-serif;
  text-align: center;
  letter-spacing: 0.02em;
}
.btn-add-to-cart:hover {
  background: #5a873b;
  box-shadow: 0 6px 24px rgba(90, 158, 56, 0.35);
}
.btn-add-to-cart:active {
  transform: scale(0.98);
}
.btn-add-to-cart.added {
  background: #3a8a28;
  pointer-events: none;
}
.btn-add-to-cart.added::before {
  content: '✓ ';
}

/* ─── Cart notification toast ───────────────────────────────── */
.tundrex-cart-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a3a1a;
  border: 1px solid rgba(90, 158, 56, 0.4);
  border-radius: 12px;
  padding: 14px 20px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  pointer-events: none;
  max-width: 300px;
}
.tundrex-cart-toast.visible {
  transform: translateY(0);
  opacity: 1;
}
.tundrex-cart-toast-icon {
  color: #7dc455;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .tundrex-cart-drawer {
    width: 100vw;
  }
}

/* Prevent body scroll when cart is open */
body.tundrex-cart-open {
  overflow: hidden;
}
