/* ============================================================================
   Failsafe Studio: Slide-Out Shopping Cart Drawer & Floating Launcher
   Architecture Target: Blueprint §1.2, §10, Modern E-Commerce Standard
   ============================================================================ */

/* 1. Floating Cart Trigger (Launcher Button) */
.failsafe-cart-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0d1527, #131d36);
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: 999px;
  padding: 10px 18px;
  color: #f8fafc;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 0 16px rgba(6, 182, 212, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.failsafe-cart-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: #06b6d4;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 24px rgba(6, 182, 212, 0.45);
  background: linear-gradient(135deg, #111a33, #182547);
}

.failsafe-cart-launcher:active {
  transform: translateY(0) scale(0.98);
}

.failsafe-cart-launcher-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.failsafe-cart-launcher-badge {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #ffffff;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  padding: 0 6px;
  margin-left: 2px;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  transition: transform 0.2s ease;
}

.failsafe-cart-launcher-badge.bounce {
  animation: cartBadgeBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cartBadgeBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* 2. Backdrop Overlay */
.failsafe-cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.failsafe-cart-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* 3. Slide-Out Drawer Container */
.failsafe-cart-drawer {
  position: fixed;
  top: 0;
  right: -480px;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: #0b111e;
  border-left: 1px solid #1d2b45;
  box-shadow: -12px 0 45px rgba(0, 0, 0, 0.7);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.failsafe-cart-drawer.is-open {
  right: 0;
}

/* 4. Drawer Header */
.failsafe-cart-header {
  padding: 18px 24px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.failsafe-cart-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.failsafe-cart-count-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
}

.failsafe-cart-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.failsafe-cart-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(90deg);
}

/* 5. Drawer Body / Item List */
.failsafe-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.failsafe-cart-body::-webkit-scrollbar {
  width: 6px;
}
.failsafe-cart-body::-webkit-scrollbar-track {
  background: transparent;
}
.failsafe-cart-body::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
.failsafe-cart-body::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Empty State */
.failsafe-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}

.failsafe-cart-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.8;
  filter: drop-shadow(0 0 12px rgba(6, 182, 212, 0.2));
}

.failsafe-cart-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 8px;
}

.failsafe-cart-empty-text {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 24px;
  max-width: 260px;
}

.failsafe-cart-empty-btn {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #06b6d4;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.failsafe-cart-empty-btn:hover {
  background: #06b6d4;
  color: #0a0e17;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
}

/* Cart Item Card */
.failsafe-cart-item {
  background: #111827;
  border: 1px solid #1f293d;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  gap: 12px;
  position: relative;
  transition: border-color 0.2s ease;
}

.failsafe-cart-item:hover {
  border-color: #2e3e5c;
}

.failsafe-cart-item-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  border: 1px solid #283754;
  flex-shrink: 0;
}

.failsafe-cart-item-img-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #172554, #1e1b4b);
  border: 1px solid #283754;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.failsafe-cart-item-content {
  flex: 1;
  min-width: 0;
}

.failsafe-cart-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
  transition: color 0.15s ease;
}

.failsafe-cart-item-title:hover {
  color: #06b6d4;
}

.failsafe-cart-item-tier {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.failsafe-cart-item-tier span {
  color: #10b981;
  font-weight: 600;
}

.failsafe-cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.failsafe-cart-stepper {
  display: inline-flex;
  align-items: center;
  background: #0b111e;
  border: 1px solid #22304d;
  border-radius: 6px;
  overflow: hidden;
}

.failsafe-cart-stepper-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.failsafe-cart-stepper-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.failsafe-cart-stepper-qty {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  min-width: 24px;
  text-align: center;
  user-select: none;
}

.failsafe-cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: -0.01em;
}

.failsafe-cart-item-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.failsafe-cart-item-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* 6. Drawer Footer */
.failsafe-cart-footer {
  padding: 20px 24px;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.failsafe-cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.failsafe-cart-summary-label {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.failsafe-cart-subtotal-val {
  font-size: 22px;
  font-weight: 800;
  color: #06b6d4;
  letter-spacing: -0.02em;
}

.failsafe-cart-note {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: -4px;
}

.failsafe-cart-actions {
  display: flex;
  gap: 10px;
}

.failsafe-cart-btn-clear {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.failsafe-cart-btn-clear:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05);
}

.failsafe-cart-btn-checkout {
  flex: 1;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  border: none;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
  transition: all 0.2s ease;
}

.failsafe-cart-btn-checkout:hover {
  background: linear-gradient(135deg, #0891b2, #1d4ed8);
  box-shadow: 0 6px 22px rgba(6, 182, 212, 0.5);
  transform: translateY(-1px);
}

.failsafe-cart-btn-checkout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.failsafe-cart-trust-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
  justify-content: center;
}

.failsafe-cart-trust-row span {
  color: #10b981;
}

/* Toast notification when adding item */
.failsafe-cart-toast {
  position: fixed;
  bottom: 84px;
  right: 28px;
  z-index: 1002;
  background: #0f172a;
  border: 1px solid #06b6d4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(6, 182, 212, 0.3);
  border-radius: 8px;
  padding: 10px 16px;
  color: #f1f5f9;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.failsafe-cart-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
