/* ============================================================
   GSP Purchase Widget — purchase.css
   تم: light، accent آبی #386AF6، فونت YekanBakh
   ============================================================ */

:root {
  --gsp-accent: #386af6;
  --gsp-accent-dark: #2557e0;
  --gsp-bg: #ffffff;        /* پس‌زمینه‌ی اینپوت‌ها */
  --gsp-surface: #eceef2;   /* پس‌زمینه‌ی کانتینر */
  --gsp-border: #C9CCD1;    /* خطوط و حاشیه‌ها */
  --gsp-text: #1a1f2e;      /* متن اصلی */
  --gsp-muted: #6b7280;     /* لیبل‌ها و متن کم‌رنگ */
  --gsp-warning-bg: #fffbf0;
  --gsp-warning-bdr: #fde68a;
  --gsp-radius: 6px;
  --gsp-transition: 0.18s ease;
}

/* ─── Wrapper ─────────────────────────────────────────── */
.gsp-purchase-wrap {
  font-family: YekanBakh, Vazirmatn, sans-serif;
  direction: rtl;
  padding: 0 8px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* تمام‌عرض داخل ستون‌های Elementor / flex parent */
.elementor-widget-shortcode .elementor-shortcode {
  width: 100%;
  min-width: 0;
}

/* ─── Row ─────────────────────────────────────────────── */
.gsp-purchase-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

/* ─── Field Group ─────────────────────────────────────── */
.gsp-field-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gsp-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gsp-muted);
  letter-spacing: 0.02em;
}

/* ─── Input ───────────────────────────────────────────── */
.gsp-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.gsp-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--gsp-bg);
  border: 1.5px solid var(--gsp-border);
  border-radius: var(--gsp-radius);
  color: var(--gsp-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 16px 12px 72px;
  text-align: right;
  transition: border-color var(--gsp-transition),
    box-shadow var(--gsp-transition);
  outline: none;
  -webkit-appearance: none;
}

.gsp-input::placeholder {
  color: #9ca3af;
  font-size: 13px;
}

.gsp-input:focus {
  border-color: var(--gsp-accent);
  box-shadow: 0 0 0 3px rgba(56, 106, 246, 0.15);
}

.gsp-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gsp-input-unit {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gsp-text);
  border-right: 1.5px solid var(--gsp-border);
  pointer-events: none;
  letter-spacing: 0.03em;
}

/* ─── Divider ─────────────────────────────────────────── */
.gsp-divider-col {
  display: flex;
  align-items: center;
  padding-bottom: 2px;
}

.gsp-or {
  font-size: 13px;
  font-weight: 700;
  color: var(--gsp-muted);
  background: var(--gsp-bg);
  border: 1.5px solid var(--gsp-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Buy Button ──────────────────────────────────────── */
.gsp-buy-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gsp-accent);
  color: #fff;
  border: none;
  border-radius: var(--gsp-radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 32px;
  cursor: pointer;
  transition: background var(--gsp-transition), transform var(--gsp-transition),
    box-shadow var(--gsp-transition);
  min-width: 160px;
  height: 48px;
}

.gsp-buy-btn:hover:not(:disabled) {
  background: var(--gsp-accent-dark);
  box-shadow: 0 4px 16px rgba(56, 106, 246, 0.35);
  transform: translateY(-1px);
}

.gsp-buy-btn:active:not(:disabled) {
  transform: translateY(0);
}

.gsp-buy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── Live Price Bar ──────────────────────────────────── */
.gsp-live-price-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gsp-border);
  font-size: 13px;
  color: var(--gsp-muted);
}

.gsp-live-label,
.gsp-live-value {
  white-space: nowrap;
}

.gsp-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ecc8f;
  flex-shrink: 0;
  animation: gsp-pulse 2s infinite;
}

@keyframes gsp-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.gsp-live-value {
  font-weight: 700;
  color: var(--gsp-text);
  font-size: 14px;
}

/* ─── Modal Overlay ───────────────────────────────────── */
.gsp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: gsp-overlay-in 0.2s ease;
}

.gsp-modal-overlay[hidden] {
  display: none !important;
}

@keyframes gsp-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ─── Modal ───────────────────────────────────────────── */
.gsp-modal {
  font-family: YekanBakh, Vazirmatn, sans-serif;
  direction: rtl;
  background: #fff;
  color: #1a1a2e;
  border-radius: 20px;
  padding: 36px 32px 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  animation: gsp-modal-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gsp-modal-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ─── Modal Icon ──────────────────────────────────────── */
.gsp-modal-icon {
  text-align: center;
  margin-bottom: 12px;
  max-width: 60px;
  margin: auto;
}

/* ─── Modal Title ─────────────────────────────────────── */
.gsp-modal-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 16px;
  color: #0f172a;
}

/* ─── Modal Summary ───────────────────────────────────── */
.gsp-modal-summary {
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
  color: #374151;
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #f8faff;
  border-radius: 10px;
  border: 1px solid #e8eeff;
}

.gsp-modal-summary strong {
  color: var(--gsp-accent);
  font-weight: 800;
}

/* ─── Modal Details ───────────────────────────────────── */
.gsp-modal-details {
  border-top: 1.5px solid #f1f3f9;
  border-bottom: 1.5px solid #f1f3f9;
  padding: 12px 0;
  margin-bottom: 16px;
}

.gsp-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.gsp-detail-row + .gsp-detail-row {
  border-top: 1px solid #f1f3f9;
}

.gsp-detail-label {
  font-size: 14px;
  color: #6b7280;
}

.gsp-detail-value {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

/* ─── Warning Box ─────────────────────────────────────── */
.gsp-modal-warning {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fffbf0;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.gsp-warning-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.gsp-modal-warning p {
  font-size: 13px;
  line-height: 1.7;
  color: #78350f;
  margin: 0;
}

.gsp-modal-warning strong {
  font-weight: 700;
}

/* ─── Timer ───────────────────────────────────────────── */
.gsp-modal-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 16px;
}

.gsp-modal-timer svg {
  color: var(--gsp-accent);
}

#gsp-timer-display {
  font-size: 15px;
  font-weight: 800;
  color: var(--gsp-accent);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: center;
}

#gsp-timer-display.gsp-timer-urgent {
  color: #e84545;
  animation: gsp-blink 0.8s infinite;
}

@keyframes gsp-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ─── Terms ───────────────────────────────────────────── */
.gsp-terms-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 20px;
  user-select: none;
}

.gsp-terms-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--gsp-accent);
  cursor: pointer;
}

.gsp-terms-text {
  font-size: 13px;
  color: #374151;
}

.gsp-terms-link {
  color: var(--gsp-accent);
  text-decoration: none;
  font-weight: 600;
  margin-right: 4px;
}

.gsp-terms-link:hover {
  text-decoration: underline;
}

/* ─── Confirm Button ──────────────────────────────────── */
.gsp-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--gsp-accent);
  color: #fff;
  border: none;
  border-radius: var(--gsp-radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  padding: 16px;
  cursor: pointer;
  transition: background var(--gsp-transition), box-shadow var(--gsp-transition),
    transform var(--gsp-transition);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.gsp-confirm-btn:hover:not(:disabled) {
  background: var(--gsp-accent-dark);
  box-shadow: 0 6px 20px rgba(56, 106, 246, 0.4);
  transform: translateY(-1px);
}

.gsp-confirm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── Cancel Button ───────────────────────────────────── */
.gsp-cancel-btn {
  display: block;
  width: 100%;
  background: transparent;
  color: #6b7280;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  border-radius: var(--gsp-radius);
  transition: color var(--gsp-transition), background var(--gsp-transition);
}

.gsp-cancel-btn:hover {
  color: #374151;
  background: #f3f4f6;
}

/* ─── Error Toast ─────────────────────────────────────── */
.gsp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: #f0f2f8;
  border: 1px solid #e84545;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: YekanBakh, Vazirmatn, sans-serif;
  font-size: 14px;
  font-weight: 600;
  direction: rtl;
  z-index: 100000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.gsp-toast.gsp-toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Market State: live bar ─────────────────────────── */
.gsp-bar-open .gsp-live-dot {
  background: #2ecc8f;
}

.gsp-bar-closed .gsp-live-label,
.gsp-bar-closed .gsp-live-value {
  color: #e84545;
}

.gsp-bar-noprice .gsp-live-label,
.gsp-bar-noprice .gsp-live-value {
  color: #f59e0b;
}

.gsp-dot-closed {
  background: #e84545 !important;
  animation: none !important;
}

.gsp-dot-noprice {
  background: #f59e0b !important;
  animation: gsp-pulse 1.5s infinite !important;
}

/* ─── Market Status Message ───────────────────────────── */
.gsp-market-status {
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0 0;
  flex-basis: 100%;
  line-height: 1.6;
}

.gsp-status-closed {
  background: rgba(232, 69, 69, 0.08);
  border: 1px solid rgba(232, 69, 69, 0.25);
  color: #e84545;
  margin-top: 12px !important;
}

.gsp-status-noprice {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

/* ─── Desktop (عرض 1024px به بالا) ───────────────────── */
@media (min-width: 1024px) {
  .gsp-purchase-row {
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
  }

  .gsp-field-group {
    flex: 1 1 0;
    min-width: 0;
    max-width: 360px;
    width: auto;
  }

  .gsp-input-wrap {
    width: 100%;
    min-width: 0;
  }

  .gsp-input {
    width: 100%;
  }

  .gsp-buy-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: 324px;
    width: auto;
  }
}

/* ─── زیر 1024px — چیدمان عمودی ───────────────────────── */
@media (max-width: 1023px) {
  .gsp-purchase-row {
    flex-direction: column;
    align-items: stretch;
  }

  .gsp-field-group {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .gsp-input-wrap,
  .gsp-input,
  .gsp-buy-btn {
    width: 100%;
    min-width: 0;
  }
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .gsp-divider-col {
    justify-content: center;
  }

  .gsp-modal {
    padding: 28px 20px 24px;
  }
}

/* ─── پیام حدود خرید (هم‌استایل با وضعیت بازار) ─── */
.gsp-limit-hint {
  width: 100%;
  box-sizing: border-box;
  background: rgba(232, 69, 69, 0.08);
  border: 1px solid rgba(232, 69, 69, 0.25);
  color: #e84545;
  margin-top: 12px !important;
}
.gsp-limit-hint[hidden] { display: none; }
