.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  direction: rtl;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-box {
  background: #fff;
  border-radius: 28px;
  padding: 35px 30px 30px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 18px;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #222;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 6px;
}

.modal-subtitle {
  text-align: center;
  color: #6c757d;
  font-size: 14px;
  margin-bottom: 22px;
}

/* انتخاب نسخه */
.modal-version {
  margin-bottom: 20px;
}

.modal-version label {
  display: block;
  font-weight: 600;
  color: #2d3436;
  margin-bottom: 8px;
  font-size: 14px;
  text-align: center;
}

.version-buttons {
  display: flex;
  gap: 10px;
  direction: rtl;
}

.version-btn {
  flex: 1;
  padding: 10px 0;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  color: #2d3436;
}

.version-btn:hover {
  border-color: #b0b0b0;
}

.version-btn.active {
  border-color: #11998e;
  background: #e8f8f5;
  color: #11998e;
}

.modal-plan-info {
  display: flex;
  justify-content: space-between;
  background: #f5f7fa;
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 22px;
  font-weight: 600;
  color: #2d3436;
  font-size: 16px;
}

.modal-plan-info .plan-price {
  color: #11998e;
}

.modal-version-badge {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 30px;
  display: inline-block;
  margin-bottom: 18px;
  background: #e8f8f5;
  color: #11998e;
}

.modal-version-badge.global {
  background: #f0e6ff;
  color: #6c3cb0;
}

/* تعداد */
.modal-count {
  margin-bottom: 24px;
  text-align: center;
}

.modal-count label {
  display: block;
  font-weight: 600;
  color: #2d3436;
  margin-bottom: 10px;
  font-size: 15px;
}

.count-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  direction: ltr;
}

.count-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
}

.count-btn svg {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

.count-btn svg path {
    fill: #2d3436;
    transition: fill 0.2s ease;
}

.count-btn:hover svg path {
    fill: #11998e;
}

.count-btn:active {
    transform: scale(0.92);
}

.count-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.count-btn:disabled svg path {
    fill: #aaa;
}

/* Dark */
body.dark-modal .count-btn svg path {
    fill: #c0c0d0;
}

body.dark-modal .count-btn:hover svg path {
    fill: #38ef7d;
}

body.dark-modal .count-btn:disabled svg path {
    fill: #666;
}

.count-number {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  min-width: 44px;
  text-align: center;
}

.count-hint {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-top: 6px;
}

/* دکمه پرداخت */
.modal-pay-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: #fff;
  border: none;
  border-radius: 15px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(56, 239, 125, 0.3);
}

.modal-pay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(56, 239, 125, 0.4);
}

.modal-pay-btn:active {
  transform: scale(0.97);
}

/* DARK MODE */
body.dark-modal .modal-box {
  background: #1e1e2e;
}

body.dark-modal .modal-title {
  color: #f0f0f0;
}

body.dark-modal .modal-subtitle {
  color: #a0a0b0;
}

body.dark-modal .modal-plan-info {
  background: #2a2a3e;
  color: #c0c0d0;
}

body.dark-modal .modal-plan-info .plan-price {
  color: #38ef7d;
}

body.dark-modal .modal-close {
  color: #888;
}

body.dark-modal .modal-close:hover {
  color: #fff;
}

body.dark-modal .version-btn {
  background: #2a2a3e;
  border-color: #3a3a5a;
  color: #c0c0d0;
}

body.dark-modal .version-btn.active {
  border-color: #38ef7d;
  background: #1a3a2a;
  color: #38ef7d;
}

body.dark-modal .count-number {
  color: #f0f0f0;
}

body.dark-modal .modal-count label {
  color: #c0c0d0;
}

body.dark-modal .modal-version label {
  color: #c0c0d0;
  direction: rtl;
}

body.dark-modal .modal-version-badge {
  background: #1a2a3a;
  color: #38ef7d;
  direction: rtl;
}

body.dark-modal .modal-version-badge.global {
  background: #2a1a3a;
  color: #b088f0;
  direction: rtl;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .modal-box {
    padding: 24px 16px 20px;
    border-radius: 20px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-plan-info {
    font-size: 14px;
    padding: 12px 14px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .version-buttons {
    flex-direction: column;
    gap: 6px;
  }

  .version-btn {
    padding: 10px 0;
    font-size: 14px;
  }

  .count-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .count-number {
    font-size: 26px;
    min-width: 34px;
  }

  .modal-pay-btn {
    font-size: 15px;
    padding: 13px;
  }

  .modal-close {
    top: 8px;
    left: 12px;
    font-size: 24px;
  }
}

@media (max-width: 400px) {
  .modal-box {
    padding: 18px 12px 16px;
  }

  .modal-title {
    font-size: 17px;
  }

  .modal-plan-info {
    font-size: 12px;
    padding: 10px 10px;
  }

  .count-btn {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }

  .count-number {
    font-size: 22px;
    min-width: 28px;
  }

  .modal-pay-btn {
    font-size: 13px;
    padding: 11px;
  }
}

/* ===== توضیحات نسخه‌ها (Tips) ===== */
.version-tips {
   display: flex;
   flex-direction: column;
   gap: 10px;
   margin-bottom: 16px;
   padding: 0 4px;
   direction: rtl;
}

.version-tip {
   display: flex;
   align-items: flex-start;
   gap: 12px;
   padding: 12px 14px;
   border-radius: 12px;
   background: #f8f9fa;
   border-right: 4px solid #11998e;
   transition: all 0.3s ease;
   font-size: 14px;
   line-height: 1.6;
   color: #2d3436;
   opacity: 0.5;
   transform: scale(0.98);
}

.version-tip.active {
   opacity: 1;
   transform: scale(1);
   box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.version-tip .tip-icon {
   font-size: 22px;
   flex-shrink: 0;
   margin-top: 2px;
}

.version-tip strong {
   display: block;
   font-size: 15px;
   color: #1a1a2e;
   margin-bottom: 2px;
}

.version-tip p {
   margin: 0;
   color: #555;
   font-size: 13px;
}

.version-tip .tip-warning {
   color: #e67e22;
   font-weight: 600;
   font-size: 12px;
}

.version-tip-global {
   border-right-color: #6c3cb0;
   background: #f8f4ff;
}

.version-tip-global.active {
   border-right-color: #6c3cb0;
   background: #f0e6ff;
}

.version-tip-iran.active {
   border-right-color: #11998e;
   background: #e8f8f5;
}

/* DARK MODE */
body.dark-modal .version-tip {
   background: #25253f;
   color: #c0c0d0;
   opacity: 0.4;
}

body.dark-modal .version-tip.active {
   opacity: 1;
}

body.dark-modal .version-tip strong {
   color: #f0f0f0;
}

body.dark-modal .version-tip p {
   color: #a0a0b0;
}

body.dark-modal .version-tip-global {
   background: #2a1a3a;
}

body.dark-modal .version-tip-global.active {
   background: #3a2a5a;
}

body.dark-modal .version-tip-iran.active {
   background: #1a3a2a;
}

body.dark-modal .version-tip .tip-warning {
   color: #f39c12;
}

/* RESPONSIVE */
@media (max-width: 500px) {
   .version-tip {
      padding: 10px 12px;
      font-size: 13px;
      gap: 10px;
   }

   .version-tip .tip-icon {
      font-size: 18px;
   }

   .version-tip strong {
      font-size: 14px;
   }

   .version-tip p {
      font-size: 12px;
   }
}