/*!
 * Vaniibel — SnapPay Discount Bar
 * Premium conversion-focused promo component
 * Pure CSS — no framework dependency
 * RTL / Persian
 */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root{
  --vsp-primary: #50C878;
  --vsp-primary-dark: #34A85A;
  --vsp-primary-light: #7EDBA3;

  --vsp-purple-1: #6D28D9;
  --vsp-purple-2: #9333EA;

  --vsp-accent: #FF7A00;
  --vsp-urgent: #FF3B30;

  --vsp-glass-bg: rgba(255, 255, 255, 0.72);
  --vsp-glass-border: rgba(255, 255, 255, 0.55);
  --vsp-surface-soft: #F6F7F9;

  --vsp-ink: #17181C;
  --vsp-ink-soft: #55585F;
  --vsp-ink-faint: #8A8D94;

  --vsp-radius-lg: 22px;
  --vsp-radius-md: 14px;
  --vsp-radius-sm: 10px;
  --vsp-radius-pill: 999px;

  --vsp-shadow-card:
    0 1px 1px rgba(23, 24, 28, 0.03),
    0 8px 24px -6px rgba(23, 24, 28, 0.14),
    0 24px 48px -16px rgba(80, 200, 120, 0.22);
  --vsp-shadow-btn: 0 6px 16px -4px rgba(80, 200, 120, 0.45);
  --vsp-shadow-btn-hover: 0 10px 24px -6px rgba(80, 200, 120, 0.55);

  --vsp-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --vsp-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --vsp-dur-fast: 180ms;
  --vsp-dur-mid: 420ms;
  --vsp-dur-slow: 900ms;

  --vsp-font: "Vazirmatn", "Vazir", Tahoma, "Segoe UI", sans-serif;

  --vsp-bar-h: clamp(80px, 10vw, 120px);
  --vsp-z: 999990;
}

/* ==========================================================================
   2. FONT FACE
   ========================================================================== */
@font-face{
  font-family: inherit;
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ==========================================================================
   3. RESET
   ========================================================================== */
.vsp-root, .vsp-root *{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.vsp-root{
  direction: rtl;
  font-family: var(--vsp-font);
  -webkit-font-smoothing: antialiased;
  text-align: right;
}
.vsp-root button{
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}
.vsp-root img, .vsp-root svg{ display: block; }
.vsp-root [hidden]{ display: none !important; }

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */
.vsp-root{
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--vsp-z);
  display: flex;
  justify-content: center;
  padding: 10px clamp(10px, 2vw, 20px) calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.vsp-root.is-open{ pointer-events: auto; }

.vsp-card{
  position: relative;
  width: 100%;
  max-width: 1180px;
  min-height: 80px;
  height: var(--vsp-bar-h);
  border-radius: var(--vsp-radius-lg);
  overflow: hidden;
  background: var(--vsp-glass-bg);
  border: 1px solid var(--vsp-glass-border);
  box-shadow: var(--vsp-shadow-card);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
  padding: 0 clamp(12px, 2vw, 26px);

  transform: translateY(140%);
  opacity: 0;
  transition: box-shadow var(--vsp-dur-mid) var(--vsp-ease-out);
}

.vsp-root.is-open .vsp-card{
  animation: vspSlideIn var(--vsp-dur-slow) var(--vsp-ease-out) forwards;
}
@keyframes vspSlideIn{
  0%   { transform: translateY(140%); opacity: 0; }
  60%  { transform: translateY(-6px); opacity: 1; }
  100% { transform: translateY(0);    opacity: 1; }
}
.vsp-root.is-closing .vsp-card{
  animation: vspSlideOut var(--vsp-dur-mid) var(--vsp-ease-out) forwards;
}
@keyframes vspSlideOut{
  to{ transform: translateY(140%); opacity: 0; }
}

.vsp-card:hover{
  box-shadow:
    0 1px 1px rgba(23,24,28,.03),
    0 14px 32px -8px rgba(23,24,28,.18),
    0 30px 60px -18px rgba(80,200,120,.30);
}

.vsp-card.vsp-shake{
  animation: vspShake 600ms var(--vsp-ease-out);
}
@keyframes vspShake{
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ==========================================================================
   5. AMBIENT BACKGROUND
   ========================================================================== */
.vsp-bg{
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.vsp-bg::before{
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(38% 60% at 8% 20%, rgba(80,200,120,.20), transparent 70%),
    radial-gradient(30% 55% at 92% 85%, rgba(147,51,234,.16), transparent 70%),
    radial-gradient(24% 40% at 55% 0%, rgba(255,122,0,.10), transparent 70%);
  animation: vspGradientDrift 16s ease-in-out infinite alternate;
}
@keyframes vspGradientDrift{
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-2%, 2%) scale(1.06); }
}
.vsp-blob{
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .5;
  animation: vspFloat 9s ease-in-out infinite;
}
.vsp-blob--1{ width: 10px; height: 10px; background: var(--vsp-primary); top: 18%; left: 6%; animation-delay: 0s; }
.vsp-blob--2{ width: 6px;  height: 6px;  background: var(--vsp-purple-2); top: 65%; left: 14%; animation-delay: 1.4s; }
.vsp-blob--3{ width: 8px;  height: 8px;  background: var(--vsp-accent); top: 30%; left: 92%; animation-delay: .7s; }
@keyframes vspFloat{
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.vsp-silhouette{
  position: absolute;
  opacity: .06;
  stroke: var(--vsp-ink);
  fill: none;
  stroke-width: 1.4;
}
.vsp-silhouette--perfume{ width: 46px; height: 70px; left: 2%; top: -8px; transform: rotate(-6deg); }
.vsp-silhouette--cream{   width: 54px; height: 40px; right: 4%; bottom: -6px; }
.vsp-silhouette--leaf{    width: 40px; height: 40px; right: 30%; top: -10px; opacity: .05; }

/* ==========================================================================
   6. SEGMENTS
   ========================================================================== */
.vsp-content{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: inherit;
  width: 100%;
  height: 100%;
}

.vsp-divider{
  width: 1px;
  align-self: stretch;
  margin-block: 14px;
  background: linear-gradient(180deg, transparent, rgba(23,24,28,.10), transparent);
  flex-shrink: 0;
}

/* -- gift badge (Desktop) ------------------------------------------------ */
.vsp-badge--desktop{
  position: relative;
  flex-shrink: 0;
  width: clamp(42px, 5vw, 56px);
  height: clamp(42px, 5vw, 56px);
  border-radius: var(--vsp-radius-md);
  background: linear-gradient(145deg, var(--vsp-primary), var(--vsp-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(80,200,120,.55);
  animation: vspBreathe 3.2s ease-in-out infinite;
}
@keyframes vspBreathe{
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
.vsp-badge--desktop svg{ width: 55%; height: 55%; color: #fff; }
.vsp-badge--desktop .vsp-lottie{
  position: absolute;
  inset: -14px;
  pointer-events: none;
}
.vsp-badge--mobile{
  display: none;
}

.vsp-sparkle{
  position: absolute;
  color: var(--vsp-accent);
  opacity: 0;
  animation: vspSparkle 2.6s ease-in-out infinite;
}
.vsp-sparkle--a{ top: -4px; right: -4px; width: 12px; height: 12px; animation-delay: .2s; }
.vsp-sparkle--b{ bottom: -2px; left: -6px; width: 8px; height: 8px; animation-delay: 1.3s; }
@keyframes vspSparkle{
  0%, 100% { opacity: 0; transform: scale(.5) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(90deg); }
}

/* -- text block ------------------------------------------------------------ */
.vsp-text{
  flex-shrink: 1;
  min-width: 0;
}
.vsp-text-desktop { display: block; }
.vsp-text-mobile { display: none; }

.vsp-eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--vsp-purple-2);
  background: linear-gradient(90deg, rgba(109,40,217,.10), rgba(147,51,234,.10));
  padding: 2px 8px;
  border-radius: var(--vsp-radius-pill);
  margin-bottom: 3px;
}
.vsp-title{
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 800;
  color: var(--vsp-ink);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsp-subtitle{
  font-size: clamp(11px, 1.2vw, 12.5px);
  font-weight: 500;
  color: var(--vsp-ink-soft);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsp-subtitle strong{ color: var(--vsp-primary-dark); font-weight: 800; }

/* -- interactive coupon code chip ------------------ */
.vsp-code-wrap{
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.vsp-code{
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 9px 10px;
  border-radius: var(--vsp-radius-sm);
  border: 1.5px dashed rgba(80,200,120,.55);
  background: rgba(80,200,120,.07);
  font-weight: 800;
  font-size: clamp(12px, 1.4vw, 14px);
  letter-spacing: .04em;
  color: var(--vsp-primary-dark);
  direction: ltr;
  cursor: pointer;
  user-select: none;
  transition: transform var(--vsp-dur-fast) var(--vsp-ease-out),
              box-shadow var(--vsp-dur-fast) var(--vsp-ease-out),
              border-color var(--vsp-dur-fast) var(--vsp-ease-out);
}
.vsp-code:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(80,200,120,0.25);
  border-color: var(--vsp-primary);
}
.vsp-code:active {
  transform: translateY(0) scale(0.97);
}

.vsp-code::after{
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,.75), transparent);
  animation: vspShimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes vspShimmer{
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

.vsp-code-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--vsp-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  margin-right: 6px;
  transition: background var(--vsp-dur-fast);
}
.vsp-code:hover .vsp-code-hint {
  background: var(--vsp-primary-dark);
}
.vsp-code-hint svg {
  width: 12px;
  height: 12px;
}

.vsp-ripple{
  position: absolute;
  border-radius: 50%;
  background: rgba(80,200,120,.4);
  transform: scale(0);
  animation: vspRipple 640ms var(--vsp-ease-out);
  pointer-events: none;
}
@keyframes vspRipple{
  to{ transform: scale(3.2); opacity: 0; }
}

/* -- countdown ----------------------------------------------------------- */
.vsp-countdown{
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vsp-countdown-units{
  display: flex;
  align-items: center;
  gap: 3px;
  direction: ltr;
}
.vsp-unit{
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 30px;
  padding: 4px 4px;
  border-radius: 8px;
  background: rgba(23,24,28,.05);
}
.vsp-unit b{
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 800;
  color: var(--vsp-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.vsp-unit span{
  font-size: 8.5px;
  color: var(--vsp-ink-faint);
  font-weight: 600;
  margin-top: 1px;
}
.vsp-colon{ font-weight: 800; color: var(--vsp-ink-faint); }

.vsp-expired-msg{
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  color: var(--vsp-ink-soft);
}

/* -- urgency badge --------------------------------------------------------- */
.vsp-urgency{
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: var(--vsp-radius-pill);
  background: linear-gradient(135deg, rgba(255,59,48,.12), rgba(255,122,0,.12));
  border: 1px solid rgba(255,59,48,.22);
  color: var(--vsp-urgent);
  font-size: clamp(10.5px, 1.1vw, 11.5px);
  font-weight: 800;
  white-space: nowrap;
  animation: vspPulseGlow 2.2s ease-in-out infinite;
}
@media (min-width: 900px){
  .vsp-urgency--desktop{ display: inline-flex; }
}
@keyframes vspPulseGlow{
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,59,48,.25); }
  50%      { box-shadow: 0 0 0 6px rgba(255,59,48,0); }
}
.vsp-urgency svg{
  width: 13px; height: 13px;
  animation: vspFireFlicker 1.1s ease-in-out infinite;
}
@keyframes vspFireFlicker{
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.12) rotate(-4deg); }
}

/* -- payment notice icon (shield/card) ------------------------------------ */
.vsp-notice{
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--vsp-ink-faint);
  font-size: 10.5px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
@media (min-width: 1180px){
  .vsp-notice--desktop{ display: inline-flex; }
}
.vsp-notice svg{ width: 14px; height: 14px; color: var(--vsp-purple-2); }

/* -- close button ---------------------------------------------------------- */
.vsp-close{
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vsp-ink-faint);
  background: rgba(23,24,28,.05);
  transition: background var(--vsp-dur-fast), color var(--vsp-dur-fast), transform var(--vsp-dur-fast);
  z-index: 2;
}
.vsp-close:hover{
  background: rgba(255,59,48,.12);
  color: var(--vsp-urgent);
  transform: rotate(90deg);
}
.vsp-close svg{ width: 13px; height: 13px; }
.vsp-close:focus-visible,
.vsp-code:focus-visible{
  outline: 2px solid var(--vsp-purple-2);
  outline-offset: 2px;
}

/* ==========================================================================
   7. TOAST
   ========================================================================== */
.vsp-toast{
  position: fixed;
  bottom: calc(var(--vsp-bar-h) + 26px);
  left: 50%;
  transform: translate(-50%, 16px);
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--vsp-radius-pill);
  background: var(--vsp-ink);
  color: #fff;
  font-family: var(--vsp-font);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 28px -8px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--vsp-dur-mid) var(--vsp-ease-out),
              transform var(--vsp-dur-mid) var(--vsp-ease-spring);
}
.vsp-toast.is-visible{
  opacity: 1;
  transform: translate(-50%, 0);
}
.vsp-toast svg{ width: 15px; height: 15px; color: var(--vsp-primary-light); flex-shrink: 0; }

/* ==========================================================================
   8. RESPONSIVE (موبایل و دیوایس‌های کوچک)
   ========================================================================== */
@media (max-width: 899px) {
  :root{ --vsp-bar-h: auto; }
  .vsp-root{ padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); bottom: 50px;}
  .vsp-card{
    padding: 12px 10px 12px 38px; /* پدینگ سمت چپ ۳۸ پیکسل برای محافظت از دکمه بستن */
    height: auto;
    min-height: 80px;
    gap: 0;
  }
  .vsp-content{
    display: grid;
    /* سطر اول دقیقا ۳ ستون: سمت راست (بج)، وسط (متن) و سمت چپ (کد) */
    grid-template-columns: min-content 1fr min-content;
    grid-template-rows: auto auto;
    gap: 12px 6px;
    width: 100%;
    align-items: center;
    
  }

  /* مخفی کردن المان‌های دسکتاپ و بج بنفش قدیمی */
  .vsp-badge--desktop, .vsp-text-desktop, .vsp-divider, .vsp-notice { display: none; }
  .vsp-badge--mobile { display: none !important; }

  /* سطر اول - ستون راست: بج قرمز فوریت */
  .vsp-urgency {
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 1;
    padding: 6px 8px;
    font-size: 9.5px;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    min-width: 60px;
    max-width: 75px;
    border-radius: var(--vsp-radius-sm);
  }
  .vsp-urgency svg { width: 12px; height: 12px; margin-bottom: 3px; margin-inline: auto; }

  /* سطر اول - ستون وسط: متون سه خطی */
  .vsp-text-mobile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    grid-column: 2;
    grid-row: 1;
    gap: 4px;
    text-align: center;
  }
  .vsp-text-mobile p {
    font-size: 10px;
    font-weight: 600;
    color: var(--vsp-ink-soft);
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
  }
  .vsp-text-mobile p strong { color: var(--vsp-ink); font-weight: 800; font-size: 11px; }

  /* سطر اول - ستون چپ: باکس کد تخفیف */
  .vsp-code-wrap {
    grid-column: 3;
    grid-row: 1;
  }
  .vsp-code {
    padding: 6px;
    font-size: 11.5px;
    gap: 4px;
  }
  /* در موبایل آیکون اصلی کوپن مخفی می‌شود تا جای کمتری بگیرد */
  .vsp-code > svg:first-child { display: none; } 
  .vsp-code-hint {
    padding: 4px;
    margin-right: 2px;
  }
  /* در موبایل کلمه 'کپی' مخفی می‌شود و فقط آیکون می‌ماند */
  .vsp-code-hint span { display: none; }

  /* سطر دوم - تمام‌عرض: تایمر */
  .vsp-countdown {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px dashed rgba(23, 24, 28, 0.08); /* خط جداکننده محو */
    margin-top: 2px;
  }
  .vsp-unit { min-width: 28px; padding: 4px; }
  .vsp-unit b { font-size: 13px; }
  .vsp-unit span { font-size: 8px; }
}

/* ==========================================================================
   9. ACCESSIBILITY — reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce){
  .vsp-root *{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .vsp-root.is-open .vsp-card{ transform: translateY(0); opacity: 1; }
}

/* GPU hints */
.vsp-card, .vsp-badge--desktop, .vsp-code, .vsp-toast{
  will-change: transform;
}