/* === شانسینو - استایل فرانت‌اند (نسخه حرفه‌ای) === */
/* توسعه توسط xenonqode.ir */

/* ========== متغیرهای سراسری ========== */
:root {
  --shansino-primary: #6c3ce1;
  --shansino-primary-hover: #5a2fc9;
  --shansino-success: #10b981;
  --shansino-warning: #f59e0b;
  --shansino-danger: #ef4444;
  --shansino-surface: #ffffff;
  --shansino-surface-alt: #f8f9fa;
  --shansino-border: #e5e7eb;
  --shansino-text: #1f2937;
  --shansino-text-muted: #6b7280;
  --shansino-font: "IRANYekanX", Tahoma, sans-serif;
  --shansino-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --shansino-radius-sm: 8px;
  --shansino-radius-md: 12px;
  --shansino-radius-lg: 16px;
  --shansino-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shansino-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shansino-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --shansino-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --shansino-surface: #1f2937;
    --shansino-surface-alt: #111827;
    --shansino-border: #374151;
    --shansino-text: #f9fafb;
    --shansino-text-muted: #9ca3af;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== نشان قرعه‌کشی ========== */
.shansino-badge-wrapper {
  position: relative;
  display: inline-block;
  contain: layout style;
}

.shansino-badge {
  position: absolute;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--shansino-spacing-xs) var(--shansino-spacing-sm);
  font-family: var(--shansino-font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  border-radius: 50px;
  white-space: nowrap;
  pointer-events: none;
  contain: layout;
  transition: var(--shansino-transition);
}

/* استایل‌های نشان */
.shansino-badge--solid {
  background: var(--shansino-badge-bg, #fff5f5);
  color: var(--shansino-badge-color, #ff4757);
  border: 2px solid var(--shansino-badge-color, #ff4757);
}

.shansino-badge--outlined {
  background: transparent;
  color: var(--shansino-badge-color, #ff4757);
  border: 2px solid var(--shansino-badge-color, #ff4757);
}

.shansino-badge--gradient {
  background: linear-gradient(
    135deg,
    var(--shansino-primary),
    var(--shansino-primary-hover)
  );
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(108, 60, 225, 0.3);
}

.shansino-badge--glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: var(--shansino-text);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* آیکون‌های SVG */
.shansino-badge__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
}

/* انیمیشن‌ها */
.shansino-badge--pulse {
  animation: shansino-pulse 2s infinite;
}

.shansino-badge--bounce {
  animation: shansino-bounce 1.5s infinite;
}

.shansino-badge--slide {
  animation: shansino-slide-in 0.4s ease-out;
}

@keyframes shansino-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shansino-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes shansino-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* موقعیت‌ها */
.shansino-badge--top-right {
  top: 8px;
  right: 8px;
}
.shansino-badge--top-left {
  top: 8px;
  left: 8px;
}
.shansino-badge--bottom-right {
  bottom: 8px;
  right: 8px;
}
.shansino-badge--bottom-left {
  bottom: 8px;
  left: 8px;
}

/* Tooltip */
.shansino-badge__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--shansino-surface);
  color: var(--shansino-text);
  padding: 8px 12px;
  border-radius: var(--shansino-radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shansino-shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: var(--shansino-transition);
  z-index: 11;
  pointer-events: none;
}

.shansino-badge__tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--shansino-surface);
}

.shansino-badge-wrapper:hover .shansino-badge__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ========== شمارنده معکوس ========== */
.shansino-countdown {
  text-align: center;
  padding: var(--shansino-spacing-md);
  background: var(--shansino-surface);
  border-radius: var(--shansino-radius-lg);
  box-shadow: var(--shansino-shadow-md);
  margin: var(--shansino-spacing-md) 0;
  font-family: var(--shansino-font);
}

.shansino-countdown__title {
  margin: 0 0 var(--shansino-spacing-sm) 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--shansino-text);
}

.shansino-countdown__timer {
  display: flex;
  justify-content: center;
  gap: var(--shansino-spacing-sm);
}

.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--shansino-spacing-xs) var(--shansino-spacing-sm);
  background: var(--shansino-surface-alt);
  border-radius: var(--shansino-radius-md);
  min-width: 64px;
  transition: var(--shansino-transition);
}

.countdown-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shansino-shadow-sm);
}

.countdown-value {
  font-family: var(--shansino-font-mono);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--shansino-primary);
  tabular-nums: true;
}

.countdown-label {
  font-size: 11px;
  color: var(--shansino-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* حالت پایان */
.shansino-countdown--finished .countdown-value {
  color: var(--shansino-success);
}

.shansino-countdown__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--shansino-spacing-sm);
  padding: 8px 16px;
  background: var(--shansino-primary);
  color: #fff;
  border: none;
  border-radius: var(--shansino-radius-sm);
  font-family: var(--shansino-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--shansino-transition);
}

.shansino-countdown__cta:hover {
  background: var(--shansino-primary-hover);
  transform: translateY(-1px);
}

/* نسخه Badge شمارنده */
.shansino-countdown-badge {
  position: absolute;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-family: var(--shansino-font);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50px;
  background: var(--shansino-countdown-bg, var(--shansino-primary));
  color: var(--shansino-countdown-color, #fff);
  white-space: nowrap;
  pointer-events: none;
  contain: layout;
}

.shansino-countdown-badge__block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.shansino-countdown-badge__val {
  font-size: 11px;
  font-weight: 900;
}

.shansino-countdown-badge__lbl {
  font-size: 7px;
  opacity: 0.9;
}

/* ========== پاپ‌آپ برنده ========== */
.shansino-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--shansino-spacing-md);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: var(--shansino-transition);
}

.shansino-modal--active {
  opacity: 1;
  visibility: visible;
}

.shansino-modal__content {
  width: 100%;
  max-width: 420px;
  background: var(--shansino-surface);
  border-radius: var(--shansino-radius-lg);
  padding: var(--shansino-spacing-md);
  box-shadow: var(--shansino-shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: var(--shansino-transition);
  position: relative;
}

.shansino-modal--active .shansino-modal__content {
  transform: scale(1) translateY(0);
}

.shansino-modal__close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shansino-surface-alt);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--shansino-transition);
}

.shansino-modal__close:hover {
  background: var(--shansino-border);
}

.shansino-modal__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--shansino-warning);
}

.shansino-modal__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--shansino-text);
  text-align: center;
}

.shansino-modal__desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--shansino-text-muted);
  text-align: center;
  line-height: 1.6;
}

.shansino-modal__code {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 0 0 16px;
  background: var(--shansino-surface-alt);
  border: 2px dashed var(--shansino-border);
  border-radius: var(--shansino-radius-md);
  font-family: var(--shansino-font-mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--shansino-primary);
  text-align: center;
  letter-spacing: 2px;
  direction: ltr;
}

.shansino-modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.shansino-modal__btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  background: var(--shansino-primary);
  color: #fff;
  border: none;
  border-radius: var(--shansino-radius-sm);
  font-family: var(--shansino-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--shansino-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.shansino-modal__btn:hover {
  background: var(--shansino-primary-hover);
  transform: translateY(-1px);
}

.shansino-modal__btn--secondary {
  background: var(--shansino-surface-alt);
  color: var(--shansino-text);
}

.shansino-modal__btn--secondary:hover {
  background: var(--shansino-border);
}

.shansino-modal__btn__icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Confetti سبک با CSS */
.shansino-confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--shansino-warning);
  border-radius: 2px;
  animation: shansino-confetti-fall 3s ease-in-out forwards;
  opacity: 0;
}

@keyframes shansino-confetti-fall {
  0% {
    transform: translateY(-100px) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

/* ========== رسپانسیو ========== */
@media (max-width: 768px) {
  .shansino-countdown__timer {
    gap: 6px;
  }
  .countdown-item {
    min-width: 52px;
    padding: 6px 8px;
  }
  .countdown-value {
    font-size: 18px;
  }
  .countdown-label {
    font-size: 10px;
  }
  .shansino-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  .shansino-badge__icon {
    width: 12px;
    height: 12px;
  }
  .shansino-modal__content {
    max-width: 95vw;
    padding: 20px;
  }
  .shansino-modal__code {
    font-size: 18px;
  }
}

/* ========== RTL Support ========== */
[dir="rtl"] .shansino-modal__close {
  left: auto;
  right: 12px;
}
[dir="rtl"] .shansino-modal__code {
  direction: ltr;
}
