#cart-toggle {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #C0C0C0;
  color: #0b0f19;
  border: 2px solid #000;
  box-shadow: 4px 4px 0 #000;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 14px;
  padding: 6px 10px;
  cursor: pointer;
}

#cart-toggle:hover {
  background: #d4d4d4;
}

#cart-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.cart-toggle-count {
  background: #000080;
  color: #fff;
  border: 2px solid #000;
  padding: 0 6px;
  min-width: 22px;
  text-align: center;
  font-size: 12px;
}

.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1500;
}

.cart-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(380px, 92vw);
  background: #C0C0C0;
  border-left: 2px solid #000;
  box-shadow: -4px 0 0 #000;
  font-family: 'Courier New', Courier, monospace;
  color: #0b0f19;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1600;
  display: flex;
  flex-direction: column;
}

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

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #0b0f19;
  color: #e2e8f0;
  border-bottom: 2px solid #000;
}

.cart-drawer-header h2 {
  margin: 0;
  font-size: 18px;
}

#cart-close {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

#cart-close:hover {
  background: #e2e8f0;
  color: #0b0f19;
}

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

.cart-empty {
  text-align: center;
  color: #0b0f19;
  font-style: italic;
  margin-top: 40px;
}

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: flex-start;
  background: #e2e8f0;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  padding: 8px;
  margin-bottom: 12px;
}

.cart-line-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  background: #1e293b;
  border: 2px solid #000;
}

.cart-line-info {
  min-width: 0;
}

.cart-line-name {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 2px;
  word-break: break-word;
}

.cart-line-price {
  color: #1e293b;
  font-size: 12px;
  margin-bottom: 6px;
}

.cart-line-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.cart-line-qty button {
  background: #C0C0C0;
  border: 2px solid #000;
  font-family: inherit;
  font-weight: bold;
  width: 24px;
  height: 24px;
  cursor: pointer;
  padding: 0;
}

.cart-line-qty button:hover {
  background: #d4d4d4;
}

.cart-line-qty .cart-line-remove {
  width: auto;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 11px;
  color: #000080;
}

.cart-line-subtotal {
  font-weight: bold;
  font-size: 13px;
  white-space: nowrap;
}

.cart-drawer-footer {
  border-top: 2px solid #000;
  padding: 12px 14px;
  background: #C0C0C0;
}

.cart-drawer-footer:empty {
  display: none;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 10px;
}

#cart-checkout {
  display: block;
  width: 100%;
  background: #000080;
  color: #fff;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  padding: 10px;
  cursor: pointer;
  margin-bottom: 8px;
}

#cart-checkout:hover {
  background: #0000a0;
}

#cart-checkout:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.cart-clear {
  display: block;
  width: 100%;
  background: transparent;
  border: 2px solid #000;
  color: #0b0f19;
  font-family: inherit;
  font-size: 12px;
  padding: 6px;
  cursor: pointer;
}

.cart-clear:hover {
  background: #0b0f19;
  color: #C0C0C0;
}

body.cart-locked {
  overflow: hidden;
}

.add-to-cart-btn {
  display: inline-block;
  margin-top: 10px;
  margin-right: 6px;
  background: #00FF00;
  color: #0b0f19;
  padding: 5px 10px;
  text-decoration: none;
  font-weight: bold;
  border: 2px solid #000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

.add-to-cart-btn:hover {
  background: #33ff33;
}

.add-to-cart-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.add-to-cart-btn:disabled,
.add-to-cart-btn.sold-out {
  background: #888;
  color: #ddd;
  cursor: not-allowed;
  box-shadow: 2px 2px 0 #000;
}

.stock-badge {
  display: inline-block;
  margin-left: 8px;
  margin-top: 10px;
  padding: 3px 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid #000;
  vertical-align: middle;
}

.stock-badge:empty {
  display: none;
}

.stock-badge.stock-in {
  background: #00FF00;
  color: #0b0f19;
}

.stock-badge.stock-low {
  background: #ffb703;
  color: #0b0f19;
}

.stock-badge.stock-out {
  background: #0b0f19;
  color: #ff4d4d;
}

.stock-badge .stock-short {
  display: none;
}

@media (max-width: 600px) {
  .stock-badge .stock-long {
    display: none;
  }
  .stock-badge .stock-short {
    display: inline;
  }
}

#cart-checkout:disabled {
  background: #555;
  cursor: not-allowed;
  box-shadow: 1px 1px 0 #000;
}

.product-option {
  margin: 8px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.product-option .add-to-cart-btn {
  margin: 0;
}

.product-option .stock-badge {
  margin: 0;
}

#cart-toast-stack {
  position: fixed;
  top: 60px;
  right: 14px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(340px, 88vw);
}

.cart-toast {
  background: #0b0f19;
  color: #ff4d4d;
  border: 2px solid #ff4d4d;
  box-shadow: 3px 3px 0 #000;
  padding: 8px 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
}

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

.cart-toast.leaving {
  opacity: 0;
  transform: translateX(12px);
}

.cart-toast-info {
  color: #00FF00;
  border-color: #00FF00;
}

.cart-success-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.75);
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cart-success-modal.open {
  display: flex;
  animation: cart-fade-in 0.25s ease;
}

@keyframes cart-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cart-success-card {
  background: #C0C0C0;
  border: 2px solid #000;
  box-shadow: 6px 6px 0 #000;
  padding: 28px 26px 22px;
  font-family: 'Courier New', Courier, monospace;
  color: #0b0f19;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: cart-pop 0.3s ease;
}

@keyframes cart-pop {
  from { transform: translateY(8px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.cart-success-mark {
  display: block;
  width: 72px;
  height: 72px;
  padding: 10px;
  margin: 0 auto 14px;
  background: #00FF00;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  object-fit: contain;
  box-sizing: border-box;
}

.cart-success-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.cart-success-card p {
  margin: 6px 0;
  font-size: 14px;
}

.cart-success-sub {
  color: #1e293b;
  font-size: 12px;
}

#cart-success-close {
  margin-top: 16px;
  background: #000080;
  color: #fff;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
}

#cart-success-close:hover {
  background: #0000a0;
}

#cart-success-close:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

@media (max-width: 600px) {
  #cart-toggle {
    top: 44px;
    right: 8px;
    font-size: 12px;
    padding: 5px 8px;
  }
  #cart-toast-stack {
    top: 88px;
  }
}
