/* ==========================================================================
   AMDADY Components Stylesheet: Cart Drawer, Checkout Modal,
   Sticky Mobile CTA, Social Proof Toasts & Micro-Interactions
   ========================================================================== */

/* Cart Drawer Overlay & Panel */
.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cart-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 440px;
  background: #121216;
  border-right: 1px solid var(--border-medium);
  box-shadow: 10px 0 50px rgba(0, 0, 0, 0.8);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* RTL adjustment for drawer */
html[dir="rtl"] .cart-drawer {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border-medium);
  transform: translateX(100%);
}

.cart-drawer.active {
  transform: translateX(0) !important;
}

/* Drawer Header */
.cart-drawer-header {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.cart-drawer-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-drawer {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-drawer:hover {
  background: var(--bg-card-hover);
}

/* Free Shipping Meter */
.free-shipping-meter-wrap {
  padding: 16px 24px;
  background: #17171D;
  border-bottom: 1px solid var(--border-subtle);
}

.shipping-meter-text {
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 8px;
  text-align: center;
}

.shipping-meter-text strong {
  color: var(--accent-flame);
}

.shipping-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.shipping-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-flame), var(--accent-green));
  transition: width 0.4s ease;
}

/* Cart Items Body */
.cart-drawer-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cart-empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
}

.cart-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.cart-empty-state h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.cart-item-card {
  display: flex;
  gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
}

.cart-item-thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-info h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.cart-item-variant {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.qty-num {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.cart-item-price {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.cart-item-remove {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  color: var(--text-muted);
  font-size: 1rem;
}

.cart-item-remove:hover {
  color: #FF4444;
}

/* Promo Code Input */
.cart-promo-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.cart-promo-box input {
  flex-grow: 1;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}

.cart-promo-box button {
  padding: 10px 16px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.cart-promo-box button:hover {
  background: var(--accent-flame);
}

/* Drawer Footer */
.cart-drawer-footer {
  padding: 22px 24px;
  background: #17171D;
  border-top: 1px solid var(--border-subtle);
}

.cart-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cart-summary-row.total-row {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin: 14px 0 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.cart-summary-row.total-row .total-amount {
  font-size: 1.45rem;
  color: var(--accent-flame);
}

.vat-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.btn-drawer-checkout {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent-flame), #E03D00);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.4);
}

.btn-drawer-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 69, 0, 0.5);
}

/* ==========================================================================
   Checkout Modal (Saudi Fast Doorstep Checkout)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.checkout-modal-card {
  background: #141418;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 34px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-backdrop.active .checkout-modal-card {
  transform: scale(1);
}

.checkout-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.checkout-modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.checkout-form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  padding: 13px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-flame);
}

.payment-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.payment-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.payment-option-label:hover {
  border-color: var(--border-medium);
}

.payment-option-label input[type="radio"]:checked + .payment-text {
  color: #fff;
}

.payment-option-label:has(input[type="radio"]:checked) {
  border-color: var(--accent-flame);
  background: rgba(255, 69, 0, 0.08);
}

/* ==========================================================================
   Sticky Mobile Add-to-Cart Bar
   ========================================================================== */
.sticky-mobile-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(18, 18, 22, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-medium);
  padding: 12px 20px;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.35s ease;
}

.sticky-mobile-bar.visible {
  display: flex;
  transform: translateY(0);
}

.sticky-thumb-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sticky-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
}

.sticky-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sticky-titles h5 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.sticky-titles span {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-flame);
}

.btn-sticky-add {
  padding: 12px 24px;
  background: var(--accent-flame);
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

/* ==========================================================================
   Social Proof Live Toast (CRO)
   ========================================================================== */
.social-proof-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 24px;
  z-index: 99;
  background: rgba(24, 24, 28, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  transform: translateY(150%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.social-proof-toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
}

.toast-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast-content h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.toast-content p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.toast-content span.time {
  font-size: 0.72rem;
  color: var(--accent-flame);
}

.toast-close {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-inline-start: auto;
}

/* Responsive adjustments for mobile sticky bar */
@media (min-width: 769px) {
  .sticky-mobile-bar {
    display: none !important;
  }
}
