/* ═══════════════════════════════════════════════════════════════
   product-checkout-pro.css
   Professional Product Review & Express Checkout System
   S22MARKET — Mobile-first, RTL
═══════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --pr-primary: #4f46e5;
  --pr-accent: #7c3aed;
  --pr-success: #10b981;
  --pr-warning: #f59e0b;
  --pr-danger: #ef4444;
  --pr-surface: #ffffff;
  --pr-bg: #f8fafc;
  --pr-text: #0f172a;
  --pr-muted: #64748b;
  --pr-border: #e2e8f0;
  --pr-radius: 16px;
  --pr-shadow: 0 4px 24px rgba(79,70,229,0.10);
  --pr-anim: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Theme overrides ── */
.theme-fashion { --pr-primary: #db2777; --pr-accent: #9d174d; }
.theme-medical { --pr-primary: #0891b2; --pr-accent: #0e7490; }
.theme-education { --pr-primary: #7c3aed; --pr-accent: #5b21b6; }
.theme-general { --pr-primary: #4f46e5; --pr-accent: #4338ca; }

/* ═══════════════════════════════════════════════════
   PAGE LOADER
═══════════════════════════════════════════════════ */
.pr-page-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
}

.pr-loader-ring {
  width: 52px;
  height: 52px;
  border: 4px solid var(--pr-border);
  border-top-color: var(--pr-primary);
  border-radius: 50%;
  animation: prSpin 0.8s linear infinite;
}

@keyframes prSpin { to { transform: rotate(360deg); } }

.pr-loader-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--pr-muted);
  animation: prPulse 1.5s ease-in-out infinite;
}

@keyframes prPulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* ═══════════════════════════════════════════════════
   PRODUCT CONTENT GRID
═══════════════════════════════════════════════════ */
#product-content {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#product-content.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════
   IMAGE GALLERY
═══════════════════════════════════════════════════ */
.pr-gallery-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--pr-surface);
  box-shadow: 0 2px 24px rgba(0,0,0,.07);
  aspect-ratio: 1;
  cursor: zoom-in;
}

.pr-gallery-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.pr-gallery-wrap:hover img { transform: scale(1.04); }

.pr-gallery-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.pr-badge-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  backdrop-filter: blur(8px);
  letter-spacing: 0.3px;
}

.pr-badge-new { background: rgba(16,185,129,.9); color: #fff; }
.pr-badge-hot { background: rgba(239,68,68,.9); color: #fff; }
.pr-badge-discount { background: rgba(245,158,11,.9); color: #fff; }

/* Thumbnails */
.pr-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  margin-top: 12px;
}
.pr-thumbs::-webkit-scrollbar { display: none; }

.pr-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 2.5px solid transparent;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--pr-bg);
}

.pr-thumb.active { border-color: var(--pr-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.pr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ═══════════════════════════════════════════════════
   PRODUCT INFO SECTION
═══════════════════════════════════════════════════ */
.pr-info-section { display: flex; flex-direction: column; gap: 16px; }

/* Store badge */
.pr-store-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(79,70,229,.06), rgba(124,58,237,.04));
  border: 1px solid rgba(79,70,229,.12);
  border-radius: 14px;
}

.pr-store-badge img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--pr-border);
}

.pr-store-badge .pr-store-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--pr-text);
}

.pr-store-badge .pr-store-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--pr-muted);
}

/* Product title */
.pr-product-title {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 900;
  color: var(--pr-text);
  line-height: 1.3;
  margin: 0;
}

/* Price block */
.pr-price-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pr-price-main {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 900;
  color: var(--pr-primary);
  line-height: 1;
}

.pr-price-unit {
  font-size: 14px;
  font-weight: 700;
  color: var(--pr-muted);
}

.pr-price-old {
  font-size: 16px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 600;
}

.pr-price-discount-tag {
  background: #fef2f2;
  color: var(--pr-danger);
  border: 1px solid #fecaca;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

/* ═══════════════════════════════════════════════════
   VARIANT SELECTORS (SIZES / COLORS)
═══════════════════════════════════════════════════ */
.pr-variant-section {
  background: var(--pr-surface);
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  padding: 14px;
}

.pr-variant-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pr-muted);
  margin-bottom: 10px;
}

.pr-variant-label i { color: var(--pr-primary); font-size: 10px; }
.pr-required-tag {
  background: var(--pr-primary);
  color: #fff;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 900;
}

/* Size pills */
.pr-size-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-size-pill {
  min-width: 42px;
  padding: 8px 14px;
  border: 2px solid var(--pr-border);
  border-radius: 10px;
  background: var(--pr-bg);
  font-size: 13px;
  font-weight: 800;
  color: var(--pr-text);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pr-size-pill:active { transform: scale(0.93); }
.pr-size-pill.active {
  border-color: var(--pr-primary);
  background: color-mix(in srgb, var(--pr-primary) 10%, white);
  color: var(--pr-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 15%, transparent);
}

/* Color swatches */
.pr-color-swatches { display: flex; flex-wrap: wrap; gap: 10px; }

.pr-color-swatch-img {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s;
}
.pr-color-swatch-img:active { transform: scale(0.91); }
.pr-color-swatch-img .swatch-img-wrap {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  border: 2.5px solid var(--pr-border);
  overflow: hidden;
  transition: all 0.18s;
}
.pr-color-swatch-img img { width: 100%; height: 100%; object-fit: cover; }
.pr-color-swatch-img .swatch-name {
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  color: var(--pr-muted);
  margin-top: 4px;
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-color-swatch-img.active .swatch-img-wrap {
  border-color: var(--pr-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 20%, transparent);
}
.pr-color-swatch-img .swatch-check {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: var(--pr-primary);
  border-radius: 50%;
  color: #fff;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.pr-color-swatch-img.active .swatch-check { display: flex; }

.pr-color-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--pr-border);
  border-radius: 10px;
  background: var(--pr-bg);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s;
}
.pr-color-pill.active { border-color: var(--pr-primary); background: color-mix(in srgb, var(--pr-primary) 8%, white); color: var(--pr-primary); }

/* Color dot */
.pr-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   EXPRESS CHECKOUT FORM — PREMIUM REBUILD
═══════════════════════════════════════════════════ */
#express-checkout-app {
  margin-top: 0;
}

/* ── Wrapper ── */
.ec-pro-wrapper {
  background: var(--pr-surface);
  border: 1.5px solid rgba(79,70,229,.12);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 6px 40px rgba(79,70,229,.10), 0 2px 8px rgba(0,0,0,.04);
  animation: ecFadeUp .4s cubic-bezier(.34,1,.64,1) both;
}

@keyframes ecFadeUp {
  from { opacity:0; transform: translateY(16px); }
  to   { opacity:1; transform: translateY(0);    }
}

/* ── Header ── */
.ec-pro-header {
  background: linear-gradient(135deg, var(--pr-primary) 0%, var(--pr-accent) 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.ec-pro-header::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}

.ec-pro-header-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.18);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.ec-pro-header h3 {
  color: #fff; font-size: 15px; font-weight: 900; margin: 0 0 2px;
}
.ec-pro-header p {
  color: rgba(255,255,255,.78); font-size: 11px; font-weight: 600; margin: 0;
}

/* Secure badge in header */
.ec-secure-badge {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: 11px; font-weight: 800;
  padding: 5px 10px; border-radius: 999px;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.ec-pro-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-x: hidden;
}

/* ── Step Blocks ── */
.ec-step-block {
  border: 1.5px solid var(--pr-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--pr-surface);
  transition: border-color .2s, box-shadow .2s;
}

.ec-step-block:focus-within {
  border-color: var(--pr-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 10%, transparent);
}

.ec-step-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--pr-bg);
  border-bottom: 1px solid var(--pr-border);
}

.ec-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pr-primary), var(--pr-accent));
  color: #fff; font-size: 12px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px color-mix(in srgb, var(--pr-primary) 30%, transparent);
}

.ec-step-title {
  font-size: 13px; font-weight: 900; color: var(--pr-text);
}

/* ── Fields ── */
.ec-fields-col { display: flex; flex-direction: column; gap: 0; padding: 14px 16px; }

.ec-field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ec-field-group:last-child { margin-bottom: 0; }

.ec-field-label {
  font-size: 12px; font-weight: 800; color: var(--pr-text2);
  display: flex; align-items: center; gap: 5px;
}
.ec-field-label i { color: var(--pr-primary); font-size: 11px; }

.ec-required { color: var(--pr-danger); font-size: 13px; }
.ec-opt-tag {
  font-size: 9px; font-weight: 700; color: var(--pr-muted);
  background: var(--pr-bg); border: 1px solid var(--pr-border);
  padding: 1px 6px; border-radius: 999px;
}

/* ── Input wrappers ── */
.ec-input-wrap { position: relative; }

.ec-input-icon {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--pr-muted); font-size: 13px; pointer-events: none; z-index: 1;
}

.ec-input-wrap textarea + .ec-input-icon { top: 16px; transform: none; }

/* Select wrapper */
.ec-select-wrap { position: relative; }
.ec-select-arrow {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--pr-muted); font-size: 11px; pointer-events: none;
}

/* ── Inputs ── */
.ec-input, .ec-select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--pr-border);
  border-radius: 12px;
  font-size: 15px;         /* 15px+ prevents iOS auto-zoom */
  font-weight: 700;
  color: var(--pr-text);
  background: var(--pr-bg);
  font-family: 'Tajawal', sans-serif;
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
  appearance: none; -webkit-appearance: none;
}

.ec-input.ec-has-icon  { padding-right: 40px; }
.ec-select.ec-has-icon { padding-right: 40px; padding-left: 32px; }

.ec-input:focus, .ec-select:focus {
  outline: none;
  border-color: var(--pr-primary);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 12%, transparent);
}

.ec-input.error, .ec-select.error {
  border-color: var(--pr-danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
  animation: ecShake .35s ease;
}

textarea.ec-input { resize: none; line-height: 1.6; }

@keyframes ecShake {
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-5px)}
  75%{transform:translateX(5px)}
}

/* ── Delivery toggle ── */
.ec-delivery-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.ec-del-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--pr-border);
  border-radius: 14px;
  background: var(--pr-bg);
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

.ec-del-option:active { transform: scale(.97); }

.ec-del-option.active {
  border-color: var(--pr-primary);
  background: color-mix(in srgb, var(--pr-primary) 6%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 12%, transparent);
}

.ec-del-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--pr-bg);
  border: 1.5px solid var(--pr-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--pr-muted); font-size: 15px; flex-shrink: 0;
  transition: all .2s;
}

.ec-del-option.active .ec-del-icon {
  background: color-mix(in srgb, var(--pr-primary) 12%, white);
  border-color: var(--pr-primary);
  color: var(--pr-primary);
}

.ec-del-details { flex: 1; }
.ec-del-title   { font-size: 13px; font-weight: 900; color: var(--pr-text); }
.ec-del-price   { font-size: 11px; font-weight: 700; color: var(--pr-success); margin-top: 2px; }

.ec-del-check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pr-border); color: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; transition: all .2s; flex-shrink: 0;
}
.ec-del-option.active .ec-del-check {
  background: var(--pr-primary); color: #fff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--pr-primary) 35%, transparent);
}



/* Offer Cards */
.ec-offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.ec-offer-card {
  position: relative;
  border: 2px solid var(--pr-border);
  border-radius: 14px;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.22s ease;
  background: var(--pr-bg);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ec-offer-card:active { transform: scale(0.96); }

.ec-offer-card.active {
  border-color: var(--pr-primary);
  background: color-mix(in srgb, var(--pr-primary) 6%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 12%, transparent);
}

.ec-offer-card .ec-best-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245,158,11,.4);
}

.ec-offer-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--pr-muted);
  margin-bottom: 4px;
}

.ec-offer-card.active .ec-offer-title { color: var(--pr-primary); }

.ec-offer-price {
  font-size: 18px;
  font-weight: 900;
  color: var(--pr-text);
  margin-bottom: 2px;
}

.ec-offer-card.active .ec-offer-price { color: var(--pr-primary); }

.ec-offer-old {
  font-size: 11px;
  color: #94a3b8;
  text-decoration: line-through;
}

.ec-offer-save {
  font-size: 10px;
  font-weight: 900;
  color: var(--pr-success);
  margin-top: 2px;
}

.ec-offer-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--pr-border);
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}

.ec-offer-card.active .ec-offer-radio {
  border-color: var(--pr-primary);
  background: var(--pr-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-primary) 20%, transparent);
}

.ec-offer-card.active .ec-offer-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

/* ────────────────────────────────────────────────
   OLD helpers (kept for backward compat)
──────────────────────────────────────────────── */
/* ec-form-grid, ec-label, old ec-input/select kept below for non-checkout uses */
.ec-form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 12px;
}
.ec-form-grid.single { grid-template-columns: 1fr; }
.ec-field { display: flex; flex-direction: column; gap: 6px; }
.ec-field.full { grid-column: 1 / -1; }
.ec-label { font-size: 11px; font-weight: 800; color: var(--pr-muted); display: flex; align-items: center; gap: 5px; }
.ec-label i { color: var(--pr-primary); font-size: 10px; }



/* ────────────────────────────────────────────────
   OLD helpers (kept for backward compat)
──────────────────────────────────────────────── */
.ec-receipt { display: none; } /* hidden — replaced by ec-receipt-card */

/* ═══════════════════════════════════════════════
   RECEIPT CARD — PREMIUM LIVE SUMMARY
═══════════════════════════════════════════════ */
.ec-receipt-card {
  background: linear-gradient(135deg, #f8faff 0%, #ffffff 100%);
  border: 2px solid var(--pr-border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  transition: border-color .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;
}

.ec-receipt-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pr-primary), var(--pr-accent));
  opacity: 0;
  transition: opacity .3s;
}

.ec-receipt-card.ec-receipt-ready {
  border-color: color-mix(in srgb, var(--pr-primary) 35%, transparent);
  box-shadow: 0 4px 24px color-mix(in srgb, var(--pr-primary) 8%, transparent);
}

.ec-receipt-card.ec-receipt-ready::before { opacity: 1; }

/* Product preview row */
.ec-receipt-product {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ec-receipt-product-img {
  width: 52px; height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--pr-border);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.ec-receipt-product-placeholder {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--pr-primary-lt);
  color: var(--pr-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  border: 2px solid var(--pr-border);
}

.ec-receipt-product-info { flex: 1; min-width: 0; }

.ec-receipt-product-name {
  font-size: 13px; font-weight: 900; color: var(--pr-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}

.ec-receipt-product-qty {
  font-size: 11px; font-weight: 700; color: var(--pr-muted);
  background: var(--pr-bg);
  border: 1px solid var(--pr-border);
  display: inline-block; padding: 2px 8px; border-radius: 999px;
}

.ec-receipt-product-price {
  font-size: 16px; font-weight: 900; color: var(--pr-primary);
  flex-shrink: 0; white-space: nowrap;
  transition: all .3s;
}

/* Separator */
.ec-receipt-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pr-border), transparent);
  margin: 0 0 12px;
}

/* Shipping row */
.ec-receipt-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.ec-receipt-row-label {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--pr-muted);
}

.ec-receipt-row-label i { color: var(--pr-primary); font-size: 12px; }

.ec-rec-wilaya-tag {
  background: var(--pr-primary-lt);
  color: var(--pr-primary);
  font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px;
}

.ec-receipt-row-val {
  font-size: 14px; font-weight: 800; color: var(--pr-text);
}

/* Dashed divider */
.ec-receipt-dashed {
  border-top: 2px dashed var(--pr-border);
  margin: 10px 0;
}

/* Grand total row */
.ec-receipt-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ec-receipt-total-label {
  font-size: 13px; font-weight: 900; color: var(--pr-text);
}

.ec-receipt-grand-total {
  display: flex; align-items: baseline; gap: 4px;
}

.ec-receipt-grand-total #ec-rec-total {
  font-size: 26px; font-weight: 900; color: var(--pr-primary);
  transition: transform .3s;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.ec-receipt-currency {
  font-size: 14px; font-weight: 800; color: var(--pr-primary);
  opacity: .8;
}

/* Bounce animation on value change */
@keyframes ecBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); }
  70%  { transform: scale(.95); }
  100% { transform: scale(1); }
}
.ec-total-bounce { animation: ecBounce .4s cubic-bezier(.34,1.56,.64,1) both; }

/* Flash animation for price changes */
@keyframes ecFlash { 0%,100%{opacity:1} 50%{opacity:.4} }
.ec-val-flash { animation: ecFlash .4s ease; }

/* Cash on delivery badge */
.ec-cod-badge {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 8px 12px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 11px; font-weight: 800; color: #065f46;
}
.ec-cod-badge i { color: #059669; font-size: 14px; }

/* ═══════════════════════════════════════════════
   SUBMIT BUTTON — PREMIUM CTA
═══════════════════════════════════════════════ */
.ec-submit-btn {
  width: 100%;
  padding: 17px 20px;
  background: linear-gradient(135deg, var(--pr-primary) 0%, var(--pr-accent) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  transition: transform .18s, filter .18s, box-shadow .18s;
  box-shadow:
    0 8px 28px color-mix(in srgb, var(--pr-primary) 38%, transparent),
    0 2px 6px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.2);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

.ec-submit-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}

.ec-submit-btn:hover  { filter: brightness(1.06); }
.ec-submit-btn:active { transform: scale(.97); box-shadow: 0 4px 16px color-mix(in srgb, var(--pr-primary) 25%, transparent); }
.ec-submit-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.ec-submit-icon { font-size: 18px; flex-shrink: 0; }
.ec-submit-text { flex: 1; text-align: center; letter-spacing: .3px; }
.ec-submit-arrow { font-size: 13px; opacity: .8; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   TRUST BADGES ROW — PREMIUM
═══════════════════════════════════════════════ */
.ec-trust-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 8px;
  background: var(--pr-bg);
  border-radius: 14px;
  border: 1px solid var(--pr-border);
}

.ec-trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.ec-trust-item span {
  font-size: 10px; font-weight: 800; color: var(--pr-muted);
  text-align: center; line-height: 1.3;
}

.ec-trust-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pr-success) 10%, white);
  border: 1px solid color-mix(in srgb, var(--pr-success) 20%, transparent);
  color: var(--pr-success);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}



/* ═══════════════════════════════════════════════════
   SUCCESS SCREEN
═══════════════════════════════════════════════════ */
.ec-success-screen {
  padding: 32px 20px;
  text-align: center;
  animation: ecFadeIn 0.5s ease;
}

@keyframes ecFadeIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

.ec-success-icon-wrap {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 0 10px rgba(16,185,129,.1), 0 8px 32px rgba(16,185,129,.25);
  animation: ecSuccessPop 0.5s var(--pr-anim) both;
}

@keyframes ecSuccessPop { 0%{transform:scale(0)} 100%{transform:scale(1)} }

.ec-success-icon-wrap svg path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: ecDrawCheck 0.5s 0.3s ease forwards;
}

@keyframes ecDrawCheck { to { stroke-dashoffset: 0; } }

.ec-success-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--pr-text);
  margin-bottom: 8px;
}

.ec-success-subtitle {
  font-size: 14px;
  color: var(--pr-muted);
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 20px;
}

.ec-order-summary-card {
  background: var(--pr-bg);
  border: 1px solid var(--pr-border);
  border-radius: 14px;
  padding: 16px;
  text-align: right;
  margin-bottom: 20px;
}

.ec-order-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}

.ec-order-summary-row .ec-osr-label { color: var(--pr-muted); font-weight: 700; }
.ec-order-summary-row .ec-osr-val { color: var(--pr-text); font-weight: 900; }
.ec-order-summary-row .ec-osr-val.highlight { color: var(--pr-primary); font-size: 18px; }

.ec-success-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ec-btn-back, .ec-btn-orders {
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s;
  text-decoration: none;
}

.ec-btn-back {
  background: var(--pr-bg);
  color: var(--pr-muted);
  border: 1.5px solid var(--pr-border);
}
.ec-btn-back:hover { background: var(--pr-border); }

.ec-btn-orders {
  background: linear-gradient(135deg, var(--pr-primary), var(--pr-accent));
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--pr-primary) 30%, transparent);
}

/* ═══════════════════════════════════════════════════
   STICKY MOBILE BAR
═══════════════════════════════════════════════════ */
.sticky-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--pr-border);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.08);
}

.sticky-price-pill {
  background: linear-gradient(135deg, var(--pr-primary), var(--pr-accent));
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 16px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.s22-btn-add-cart {
  flex: 1;
  background: var(--pr-text);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.s22-btn-add-cart:active { transform: scale(0.97); }

/* Express mode sticky */
.sticky-action-bar.express-mode {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.buy-now-scroll {
  width: 100%;
  background: linear-gradient(135deg, var(--pr-primary), var(--pr-accent));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  padding: 14px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: ecPulseBtn 2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@keyframes ecPulseBtn {
  0%,100%{ box-shadow: 0 4px 20px color-mix(in srgb, var(--pr-primary) 30%, transparent); }
  50%{ box-shadow: 0 8px 32px color-mix(in srgb, var(--pr-primary) 50%, transparent); }
}

/* ═══════════════════════════════════════════════════
   DASHBOARD ORDER NOTIFICATION
═══════════════════════════════════════════════════ */
.dash-order-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 99999;
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.05);
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s var(--pr-anim);
  pointer-events: none;
}

.dash-order-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: all;
}

.dash-order-toast-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--pr-primary), var(--pr-accent), var(--pr-success));
  animation: dashBarAnim 3s ease-in-out infinite;
}

@keyframes dashBarAnim {
  0%,100%{ background-position: 0% 50%; }
  50%{ background-position: 100% 50%; }
}

.dash-order-toast-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--pr-border);
}

.dash-order-pulse {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pr-success), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  animation: dashPulseBg 2s ease-in-out infinite;
}

@keyframes dashPulseBg {
  0%,100%{ box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  50%{ box-shadow: 0 0 0 10px rgba(16,185,129,.0); }
}

.dash-order-toast-title { font-size: 16px; font-weight: 900; color: var(--pr-text); }
.dash-order-toast-sub { font-size: 12px; color: var(--pr-muted); font-weight: 700; }

.dash-order-toast-close {
  margin-right: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pr-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pr-muted);
  font-size: 14px;
  transition: all 0.18s;
  flex-shrink: 0;
}
.dash-order-toast-close:hover { background: var(--pr-border); color: var(--pr-text); }

.dash-order-toast-body { padding: 16px 20px; }

.dash-order-product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--pr-bg);
  border-radius: 14px;
  margin-bottom: 14px;
}

.dash-order-product-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--pr-border);
  flex-shrink: 0;
}

.dash-order-product-name { font-size: 13px; font-weight: 800; color: var(--pr-text); margin-bottom: 3px; }
.dash-order-product-meta { font-size: 11px; color: var(--pr-muted); font-weight: 700; }

.dash-order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.dash-order-info-cell {
  background: var(--pr-bg);
  border-radius: 10px;
  padding: 10px 12px;
}

.dash-order-info-cell .doi-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--pr-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.dash-order-info-cell .doi-val {
  font-size: 14px;
  font-weight: 900;
  color: var(--pr-text);
}

.doi-val.highlight { color: var(--pr-primary); }

.dash-order-toast-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dash-btn-view-orders {
  padding: 12px;
  background: linear-gradient(135deg, var(--pr-primary), var(--pr-accent));
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s;
  text-decoration: none;
}

.dash-btn-dismiss {
  padding: 12px;
  background: var(--pr-bg);
  color: var(--pr-muted);
  font-size: 13px;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  border: 1.5px solid var(--pr-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
}

.dash-btn-dismiss:hover { background: var(--pr-border); }

.dash-order-toast-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.dash-order-toast-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

/* Notification bell pulse */
.dash-notif-bell {
  animation: bellRing 0.8s ease 3;
  transform-origin: top center;
}

@keyframes bellRing {
  0%,100%{ transform: rotate(0deg); }
  25%{ transform: rotate(-15deg); }
  75%{ transform: rotate(15deg); }
}

/* ═══════════════════════════════════════════════════
   SCROLL ANIMATIONS
═══════════════════════════════════════════════════ */
.slide-up {
  animation: slideUp 0.4s ease both;
}

@keyframes slideUp {
  from { opacity:0; transform: translateY(20px); }
  to { opacity:1; transform: translateY(0); }
}

.ec-input:disabled,
.ec-select:disabled {
  opacity: 0.6;
  background-color: #f1f5f9;
  cursor: not-allowed;
  border-color: #cbd5e1;
  color: #94a3b8;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ec-form-grid { grid-template-columns: 1fr; }
  .ec-offers-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }
}

@media (max-width: 767px) {
  /* Remove top margin — description card is now above checkout */
  #express-checkout-app { margin-top: 0; }

  /* Prevent iOS auto-zoom on input focus (must be 16px+) */
  .ec-input, .ec-select {
    font-size: 16px;
    padding: 12px;
  }
  .ec-input.ec-has-icon  { padding-right: 38px; }
  .ec-select.ec-has-icon { padding-right: 38px; padding-left: 30px; }

  /* Checkout wrapper: premium card-style on mobile */
  .ec-pro-wrapper {
    border-radius: 16px !important;
    border: 1px solid var(--pr-border) !important;
    box-shadow: var(--pr-shadow) !important;
  }

  .ec-pro-header {
    padding: 14px 14px;
    gap: 10px;
  }
  .ec-pro-header h3 { font-size: 14px; }
  .ec-pro-header p { font-size: 10px; }
  .ec-pro-header-icon {
    width: 38px; height: 38px;
    border-radius: 12px;
    font-size: 17px;
  }
  .ec-secure-badge {
    font-size: 10px;
    padding: 4px 8px;
  }

  .ec-pro-body {
    padding: 12px;
  }

  /* Step blocks */
  .ec-step-block {
    border-radius: 14px;
    margin-bottom: 10px;
  }
  .ec-step-header {
    padding: 10px 12px;
  }
  .ec-step-num {
    width: 26px; height: 26px;
    font-size: 11px;
  }
  .ec-step-title { font-size: 12px; }
  .ec-fields-col { padding: 12px; }
  .ec-field-group { margin-bottom: 10px; }
  .ec-field-label { font-size: 11px; }

  /* Submit button */
  .ec-submit-btn {
    padding: 15px 16px;
    font-size: 15px;
    border-radius: 14px;
  }

  /* Trust row: compact */
  .ec-trust-row {
    gap: 6px;
    padding: 10px 6px;
    border-radius: 12px;
    flex-wrap: nowrap;
  }
  .ec-trust-item span { font-size: 9px; }
  .ec-trust-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    font-size: 12px;
  }

  /* Receipt card */
  .ec-receipt-card {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
  .ec-receipt-product-img,
  .ec-receipt-product-placeholder {
    width: 44px; height: 44px;
    border-radius: 10px;
  }
  .ec-receipt-product-name { font-size: 12px; }
  .ec-receipt-product-price { font-size: 15px; }
  .ec-receipt-grand-total #ec-rec-total { font-size: 22px; }
  .ec-receipt-total-label { font-size: 12px; }
  .ec-receipt-currency { font-size: 12px; }
  .ec-receipt-row-item { font-size: 12px; }
  .ec-receipt-row-val { font-size: 13px; }

  /* Offer cards */
  .ec-offer-card { padding: 10px 8px; }
  .ec-offer-price { font-size: 16px; }
  .ec-offer-title { font-size: 11px; }

  /* Delivery toggle */
  .ec-delivery-toggle { gap: 6px; }
  .ec-del-option {
    padding: 10px;
    font-size: 12px;
    border-radius: 12px;
  }
  .ec-del-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    font-size: 13px;
  }
  .ec-del-title { font-size: 12px; }
  .ec-del-price { font-size: 10px; }

  /* COD badge */
  .ec-cod-badge {
    padding: 7px 10px;
    font-size: 10px;
    border-radius: 8px;
  }

  /* Success screen */
  .ec-success-title { font-size: 18px; }
  .ec-success-subtitle { font-size: 13px; }
  .ec-success-actions { gap: 8px; }
  .ec-btn-back, .ec-btn-orders {
    padding: 11px 12px;
    font-size: 12px;
    border-radius: 10px;
  }
}

/* Very small phones */
@media (max-width: 375px) {
  .ec-delivery-toggle { grid-template-columns: 1fr; }
  .ec-offers-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .ec-offer-price { font-size: 14px; }
  .ec-pro-body { padding: 10px; }
  .ec-fields-col { padding: 10px; }
  .ec-receipt-grand-total #ec-rec-total { font-size: 20px; }
}

@media (min-width: 1024px) {
  .sticky-action-bar { display: none !important; }
  #express-checkout-app { margin-top: 4px; }
}

