/* ===================================================
   سیستم خرید اشتراکی — استایل فرانت‌اند
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

:root {
  --wcsp-primary:    #6366f1;
  --wcsp-primary-dark: #4f46e5;
  --wcsp-success:    #10b981;
  --wcsp-warning:    #f59e0b;
  --wcsp-danger:     #ef4444;
  --wcsp-white:      #ffffff;
  --wcsp-gray-50:    #f9fafb;
  --wcsp-gray-100:   #f3f4f6;
  --wcsp-gray-200:   #e5e7eb;
  --wcsp-gray-300:   #d1d5db;
  --wcsp-gray-400:   #9ca3af;
  --wcsp-gray-500:   #6b7280;
  --wcsp-gray-600:   #4b5563;
  --wcsp-gray-700:   #374151;
  --wcsp-gray-800:   #1f2937;
  --wcsp-radius:     14px;
  --wcsp-shadow:     0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --wcsp-shadow-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* ===== بخش اشتراکی چک‌اوت ===== */
.wcsp-checkout-section {
  background: linear-gradient(135deg, #fefce8, #fffbeb);
  border: 2px solid #fde68a;
  border-radius: var(--wcsp-radius);
  padding: 20px;
  margin: 20px 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

/* ===== چک‌باکس اشتراکی ===== */
.wcsp-checkbox-wrap {
  margin-bottom: 0;
}

.wcsp-checkbox-label {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.wcsp-checkbox-label input[type="checkbox"] {
  display: none;
}

.wcsp-checkbox-custom {
  width: 22px;
  height: 22px;
  border: 2px solid var(--wcsp-gray-300);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
  background: white;
}

.wcsp-checkbox-label input:checked + .wcsp-checkbox-custom {
  background: var(--wcsp-primary);
  border-color: var(--wcsp-primary);
}

.wcsp-checkbox-label input:checked + .wcsp-checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.wcsp-label-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--wcsp-gray-800);
}

.wcsp-label-text svg {
  width: 22px;
  height: 22px;
  stroke: var(--wcsp-primary);
}

/* ===== فیلد دُنگ ===== */
#wcsp-dong-wrap {
  margin-top: 20px;
  animation: wcspSlideDown .3s ease-out;
}

@keyframes wcspSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wcsp-field-group {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--wcsp-gray-200);
  box-shadow: var(--wcsp-shadow);
}

.wcsp-field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--wcsp-gray-700);
  margin-bottom: 12px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.wcsp-required {
  color: var(--wcsp-danger);
  margin-right: 4px;
}

.wcsp-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.wcsp-input {
  width: 100%;
  padding: 14px 16px;
  padding-left: 60px;
  border: 2px solid var(--wcsp-gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  transition: border-color .2s, box-shadow .2s;
  background: var(--wcsp-white);
  color: var(--wcsp-gray-800);
}

.wcsp-input:focus {
  outline: none;
  border-color: var(--wcsp-primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}

.wcsp-currency {
  position: absolute;
  left: 14px;
  font-size: 14px;
  color: var(--wcsp-gray-400);
  font-weight: 500;
  pointer-events: none;
}

/* ===== اطلاعات قیمت ===== */
.wcsp-price-info {
  background: var(--wcsp-gray-50);
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wcsp-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.wcsp-price-key {
  color: var(--wcsp-gray-500);
}

.wcsp-price-val {
  font-weight: 600;
  color: var(--wcsp-gray-700);
}

.wcsp-price-val.wcsp-highlight {
  color: var(--wcsp-primary);
  font-size: 16px;
}

/* ===== راهنما ===== */
.wcsp-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--wcsp-gray-400);
  margin: 12px 0 0;
  line-height: 1.6;
}

.wcsp-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.wcsp-max-hint {
  font-size: 13px;
  color: var(--wcsp-warning);
  margin-top: 8px;
  font-weight: 500;
}

/* ===== بخش پرداخت شریک ===== */
.wcsp-partner-payment-wrap {
  background: var(--wcsp-white);
  border-radius: var(--wcsp-radius);
  border: 2px solid var(--wcsp-primary);
  overflow: hidden;
  margin-bottom: 20px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  box-shadow: var(--wcsp-shadow-lg);
}

.wcsp-partner-header {
  background: linear-gradient(135deg, var(--wcsp-primary), var(--wcsp-primary-dark));
  padding: 20px 24px;
  color: white;
  display: flex;
  align-items: center;
  gap: 16px;
}

.wcsp-partner-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.wcsp-partner-badge svg {
  width: 16px;
  height: 16px;
}

.wcsp-partner-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

/* ===== پیشرفت سفارش ===== */
.wcsp-progress-section {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

.wcsp-progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.wcsp-stat {
  text-align: center;
  background: var(--wcsp-gray-50);
  border-radius: 10px;
  padding: 16px;
}

.wcsp-stat-label {
  display: block;
  font-size: 12px;
  color: var(--wcsp-gray-400);
  margin-bottom: 6px;
}

.wcsp-stat-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--wcsp-gray-800);
}

.wcsp-stat-value.wcsp-paid      { color: var(--wcsp-success); }
.wcsp-stat-value.wcsp-remaining { color: var(--wcsp-warning); }

.wcsp-progress-bar-wrap {
  height: 10px;
  background: var(--wcsp-gray-200);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.wcsp-progress-bar {
  height: 100%;
  background: linear-gradient(to left, var(--wcsp-success), #34d399);
  border-radius: 5px;
  transition: width .5s ease;
}

.wcsp-progress-label {
  font-size: 12px;
  color: var(--wcsp-gray-400);
  text-align: center;
  margin: 0;
}

/* ===== مشارکت‌کنندگان ===== */
.wcsp-contributors-section {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

.wcsp-contributors-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--wcsp-gray-700);
  margin: 0 0 16px;
}

.wcsp-contributors-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wcsp-contributor-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--wcsp-gray-50);
  border-radius: 10px;
  padding: 12px 16px;
}

.wcsp-contributor-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--wcsp-primary), #818cf8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.wcsp-contributor-info {
  flex: 1;
}

.wcsp-contributor-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--wcsp-gray-800);
}

.wcsp-contributor-date {
  display: block;
  font-size: 12px;
  color: var(--wcsp-gray-400);
  margin-top: 2px;
}

.wcsp-contributor-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--wcsp-success);
}

/* ===== فرم دُنگ شریک ===== */
.wcsp-partner-dong-wrap {
  padding: 24px;
}

.wcsp-partner-dong-wrap h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--wcsp-gray-800);
  margin: 0 0 16px;
}

/* ===== سفارش تکمیل شده ===== */
.wcsp-order-complete-notice {
  text-align: center;
  padding: 48px 24px;
}

.wcsp-notice-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.wcsp-order-complete-notice h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--wcsp-success);
  margin: 0 0 10px;
}

.wcsp-order-complete-notice p {
  color: var(--wcsp-gray-500);
  font-size: 14px;
}

/* ===== صفحه تشکر ===== */
.wcsp-thankyou-section {
  background: white;
  border-radius: var(--wcsp-radius);
  border: 2px solid #a7f3d0;
  overflow: hidden;
  margin: 24px 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  box-shadow: var(--wcsp-shadow-lg);
}

.wcsp-thankyou-header {
  background: linear-gradient(135deg, var(--wcsp-success), #34d399);
  padding: 28px 24px;
  text-align: center;
  color: white;
}

.wcsp-check-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.wcsp-thankyou-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0 0 8px;
}

.wcsp-thankyou-header p {
  color: rgba(255,255,255,.85);
  font-size: 14px;
  margin: 0;
}

.wcsp-share-section {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

/* ===== لینک اشتراکی ===== */
.wcsp-link-box {
  margin-bottom: 20px;
}

.wcsp-link-box label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--wcsp-gray-600);
  margin-bottom: 8px;
}

.wcsp-link-copy {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wcsp-link-copy input {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--wcsp-gray-200);
  border-radius: 8px;
  font-size: 13px;
  color: var(--wcsp-primary);
  background: var(--wcsp-gray-50);
  direction: ltr;
}

.wcsp-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  background: var(--wcsp-primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: all .2s;
  white-space: nowrap;
}

.wcsp-copy-btn:hover {
  background: var(--wcsp-primary-dark);
  transform: translateY(-1px);
}

.wcsp-copy-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== ارسال پیامک ===== */
.wcsp-sms-invite label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--wcsp-gray-600);
  margin-bottom: 8px;
}

.wcsp-sms-input-wrap {
  display: flex;
  gap: 10px;
}

.wcsp-phone-input {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--wcsp-gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: ltr;
  text-align: right;
}

.wcsp-phone-input:focus {
  outline: none;
  border-color: var(--wcsp-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.wcsp-send-sms-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--wcsp-success);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: all .2s;
  white-space: nowrap;
}

.wcsp-send-sms-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}

.wcsp-send-sms-btn svg {
  width: 16px;
  height: 16px;
}

.wcsp-send-sms-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* ===== وضعیت سفارش در صفحه تشکر ===== */
.wcsp-order-status-wrap {
  padding: 20px 24px;
  background: var(--wcsp-gray-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wcsp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.wcsp-status-badge.open {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.wcsp-status-badge.complete {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.wcsp-order-status-wrap p {
  font-size: 13px;
  color: var(--wcsp-gray-500);
  margin: 0;
}

.wcsp-order-status-wrap a {
  color: var(--wcsp-primary);
}

/* ===== نتیجه SMS ===== */
#wcsp_sms_result,
#wcsp_account_sms_result {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

#wcsp_sms_result.success,
#wcsp_account_sms_result.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

#wcsp_sms_result.error,
#wcsp_account_sms_result.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== پنل کاربری — جزئیات سفارش ===== */
.wcsp-account-detail-section {
  background: white;
  border-radius: var(--wcsp-radius);
  border: 2px solid var(--wcsp-gray-200);
  overflow: hidden;
  margin-top: 24px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.wcsp-account-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--wcsp-primary), #818cf8);
  color: white;
  padding: 18px 24px;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.wcsp-icon {
  font-size: 22px;
}

/* ===== آمار پیشرفت پنل کاربری ===== */
.wcsp-account-progress-wrap {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

.wcsp-account-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .wcsp-account-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.wcsp-account-stat-item {
  background: var(--wcsp-gray-50);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.wcsp-account-stat-item.paid .wcsp-account-stat-num   { color: var(--wcsp-success); }
.wcsp-account-stat-item.remaining .wcsp-account-stat-num { color: var(--wcsp-warning); }
.wcsp-account-stat-item.percent .wcsp-account-stat-num   { color: var(--wcsp-primary); }

.wcsp-account-stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--wcsp-gray-800);
  margin-bottom: 4px;
}

.wcsp-account-stat-lbl {
  font-size: 11px;
  color: var(--wcsp-gray-400);
}

.wcsp-account-progress-bar-wrap {
  height: 10px;
  background: var(--wcsp-gray-200);
  border-radius: 5px;
  overflow: hidden;
}

.wcsp-account-progress-bar {
  height: 100%;
  background: linear-gradient(to left, var(--wcsp-success), #34d399);
  border-radius: 5px;
  transition: width .5s;
}

/* ===== مشارکت‌کنندگان پنل کاربری ===== */
.wcsp-account-contributors {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

.wcsp-account-contributors h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--wcsp-gray-700);
  margin: 0 0 16px;
}

.wcsp-account-contributors-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wcsp-account-contributor-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--wcsp-gray-50);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid transparent;
  transition: border-color .2s;
}

.wcsp-account-contributor-item.initiator {
  border-color: #fde68a;
  background: #fffbeb;
}

.wcsp-account-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--wcsp-primary), #818cf8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

.wcsp-initiator-badge {
  position: absolute;
  bottom: -4px;
  left: -4px;
  font-size: 14px;
}

.wcsp-account-contributor-info {
  flex: 1;
}

.wcsp-account-contributor-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--wcsp-gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wcsp-initiator-tag {
  font-size: 11px;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.wcsp-account-contributor-date {
  font-size: 12px;
  color: var(--wcsp-gray-400);
  margin-top: 2px;
}

.wcsp-account-contributor-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--wcsp-success);
}

/* ===== اشتراک‌گذاری پنل کاربری ===== */
.wcsp-account-share-section {
  padding: 24px;
  border-bottom: 1px solid var(--wcsp-gray-100);
}

.wcsp-account-share-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--wcsp-gray-700);
  margin: 0 0 16px;
}

.wcsp-account-link-box {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.wcsp-account-link-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--wcsp-gray-200);
  border-radius: 8px;
  font-size: 12px;
  color: var(--wcsp-primary);
  direction: ltr;
  background: var(--wcsp-gray-50);
}

.wcsp-account-sms-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.wcsp-account-sms-form input {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border: 1.5px solid var(--wcsp-gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: ltr;
  text-align: right;
}

/* ===== تکمیل سفارش ===== */
.wcsp-account-complete-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: #ecfdf5;
  font-size: 14px;
}

.wcsp-complete-icon { font-size: 24px; }

.wcsp-account-complete-notice strong {
  font-weight: 700;
  color: var(--wcsp-success);
}

.wcsp-account-complete-notice span {
  color: var(--wcsp-gray-500);
}

/* ===== بج‌های پنل کاربری ===== */
.wcsp-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.wcsp-account-badge.subscription {
  background: #fef3c7;
  color: #92400e;
}

.wcsp-account-badge.partner {
  background: #d1fae5;
  color: #065f46;
}

.wcsp-account-badge.normal {
  background: var(--wcsp-gray-100);
  color: var(--wcsp-gray-400);
}

.wcsp-status-mark {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.wcsp-status-mark.open     { background: #fef3c7; color: #92400e; }
.wcsp-status-mark.complete { background: #d1fae5; color: #065f46; }

/* ===== پنهان‌کردن ===== */
.wcsp-hidden { display: none !important; }

/* ===== انیمیشن بارگذاری ===== */
@keyframes wcspPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

.wcsp-loading {
  animation: wcspPulse 1.5s infinite;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 768px) {
  .wcsp-progress-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .wcsp-sms-input-wrap {
    flex-direction: column;
  }

  .wcsp-send-sms-btn {
    width: 100%;
    justify-content: center;
  }

  .wcsp-order-status-wrap {
    flex-direction: column;
    text-align: center;
  }
}
