/* ==========================================================================
   license.css — صفحه فروش لایسنس/اشتراک (صفحه مستقل و عمومی)
   ========================================================================== */

.lic-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
}

.lic-main {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding: 0 clamp(16px, 3vw, 32px) 40px;
}

/* ------------------------------------------------ ناوبری */
.lic-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1120px, 100%);
  margin-inline: auto;
  padding: 14px clamp(16px, 3vw, 32px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.lic-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.lic-nav__brand img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 6px 16px rgba(79, 124, 255, 0.35));
}

.lic-nav__brand strong {
  display: block;
  font-size: var(--fs-md);
}

.lic-nav__brand small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--primary);
  font-weight: 600;
}

/* ------------------------------------------------ هیرو */
.lic-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: clamp(44px, 8vw, 80px) 0 clamp(28px, 5vw, 44px);
}

.lic-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: var(--radius-full);
}

.lic-hero__badge svg {
  width: 15px;
  height: 15px;
}

.lic-hero__title {
  font-size: clamp(1.7rem, 4.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
}

.lic-hero__title span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lic-hero__desc {
  max-width: 62ch;
  font-size: var(--fs-md);
  line-height: 2.1;
  color: var(--text-muted);
  margin: 0;
}

.lic-hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* ------------------------------------------------ اشتراک فعال (بنر) */
.lic-active {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(34, 197, 139, 0.14), rgba(34, 211, 238, 0.08));
  border: 1px solid color-mix(in srgb, var(--c-green) 35%, transparent);
  border-radius: var(--radius-lg);
}

.lic-active__body {
  flex: 1;
  min-width: 220px;
}

.lic-active__body h2 {
  font-size: var(--fs-md);
  margin: 0 0 4px;
}

.lic-active__body p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
}

.lic-active__body code {
  direction: ltr;
  unicode-bidi: embed;
  font-family: ui-monospace, monospace;
  font-size: var(--fs-xs);
  color: var(--c-green);
  background: color-mix(in srgb, var(--c-green) 12%, transparent);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

/* ------------------------------------------------ کارت پلن‌ها */
.lic-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: clamp(20px, 4vw, 36px) 0;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur);
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-pop);
}

.plan-card.is-popular {
  border-color: color-mix(in srgb, var(--c-purple) 55%, transparent);
  box-shadow:
    0 24px 60px -20px color-mix(in srgb, var(--c-purple) 40%, transparent),
    var(--shadow-card);
}

.plan-card__badge {
  position: absolute;
  top: -13px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  padding: 5px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--on-tone);
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  white-space: nowrap;
  box-shadow: 0 8px 20px -8px var(--primary-2);
}

.plan-card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
}

.plan-card__icon svg {
  width: 22px;
  height: 22px;
}

.plan-card__title {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin: 2px 0 0;
}

.plan-card__tagline {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.9;
  margin: 0;
  min-height: 2.6em;
}

.plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 0 14px;
  border-block: 1px dashed var(--border);
}

.plan-card__price strong {
  font-size: var(--fs-2xl);
  font-weight: 800;
}

.plan-card__price span {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

.plan-card__features {
  display: grid;
  gap: 10px;
  margin: 6px 0 14px;
  padding: 0;
  list-style: none;
  flex: 1;
}

.plan-card__features li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.8;
}

.plan-card__features svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 4px;
  color: var(--c-green);
}

/* ------------------------------------------------ بخش‌های عمومی */
.lic-section-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  text-align: center;
  margin: clamp(28px, 5vw, 48px) 0 22px;
}

/* ------------------------------------------------ امکانات */
.lic-features__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.lic-feature {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}

.lic-feature:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.lic-feature h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 12px 0 6px;
}

.lic-feature p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.9;
  margin: 0;
}

/* ------------------------------------------------ تب نقش (دانشجو / دانش‌آموز) */
.lic-role-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 28px;
  padding: 6px;
  width: fit-content;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.lic-role-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-subtle);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  white-space: nowrap;
}

.lic-role-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.lic-role-tab.is-active {
  background: var(--primary);
  color: var(--on-tone);
}

/* ------------------------------------------------ تاریخچه لایسنس */
.lic-history__hint {
  margin-top: 12px;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

.lic-history__list {
  display: grid;
  gap: 10px;
}

.lic-history__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lic-history__row code {
  direction: ltr;
  unicode-bidi: embed;
  font-family: ui-monospace, monospace;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

.lic-history__date {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

/* ------------------------------------------------ FAQ */
.lic-faq {
  display: grid;
  gap: 10px;
  width: min(760px, 100%);
  margin-inline: auto;
}

.lic-faq__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lic-faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 18px;
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur);
}

.lic-faq__item summary::-webkit-details-marker {
  display: none;
}

.lic-faq__item summary:hover {
  color: var(--primary);
}

.lic-faq__item summary svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-subtle);
  transition: transform var(--dur) var(--ease);
}

.lic-faq__item[open] summary svg {
  transform: rotate(180deg);
}

.lic-faq__item p {
  padding: 0 18px 16px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 2;
  margin: 0;
}

/* ------------------------------------------------ فوتر */
.lic-footer {
  text-align: center;
  padding: 40px 0 10px;
  border-top: 1px solid var(--border);
  margin-top: 44px;
}

.lic-footer p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 6px;
}

.lic-footer__note {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

/* ------------------------------------------------ مودال خرید */
#modal-checkout .modal__panel {
  width: min(460px, 100%);
}

.checkout-plan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.checkout-plan__body {
  flex: 1;
  min-width: 0;
}

.checkout-plan__body strong {
  display: block;
  font-size: var(--fs-md);
}

.checkout-plan__body span {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

.checkout-plan__price {
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.checkout-form {
  display: grid;
  gap: 14px;
}

/* درگاه پرداخت شبیه‌سازی‌شده */
.checkout-gateway {
  display: grid;
  gap: 14px;
}

.checkout-gateway__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
}

.checkout-gateway__head svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.checkout-gateway__head .badge {
  margin-inline-start: auto;
}

.checkout-gateway__card {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  color: var(--on-tone);
  box-shadow: 0 18px 40px -18px var(--primary);
  overflow: hidden;
}

.checkout-gateway__card::after {
  content: "";
  position: absolute;
  inset-inline-start: -30%;
  top: -60%;
  width: 70%;
  height: 220%;
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(25deg);
}

.checkout-gateway__chip {
  width: 38px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ffd76f, #f0a63c);
}

.checkout-gateway__number {
  direction: ltr;
  font-family: ui-monospace, monospace;
  font-size: var(--fs-lg);
  letter-spacing: 2px;
  text-align: center;
}

.checkout-gateway__holder {
  font-size: var(--fs-xs);
  opacity: 0.85;
}

.checkout-gateway__amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.checkout-gateway__amount span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.checkout-gateway__amount strong {
  font-size: var(--fs-lg);
  font-weight: 800;
}

/* رسید موفق */
.checkout-done {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 8px 0;
}

.checkout-done__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  color: var(--c-green);
  background: color-mix(in srgb, var(--c-green) 14%, transparent);
  border-radius: 50%;
  animation: done-pop 0.5s var(--ease);
}

.checkout-done__icon svg {
  width: 32px;
  height: 32px;
}

@keyframes done-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.checkout-done h4 {
  font-size: var(--fs-lg);
  margin: 0;
}

.checkout-done__hint {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  margin: 0;
}

.license-key {
  direction: ltr;
  width: 100%;
  padding: 14px;
  font-family: ui-monospace, monospace;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--primary);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  user-select: all;
}

.checkout-done__meta {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 18px;
  margin: 4px 0 0;
}

.checkout-done__meta dt {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  margin-bottom: 3px;
}

.checkout-done__meta dd {
  font-size: var(--fs-sm);
  font-weight: 700;
  margin: 0;
}

/* حالت لودینگ دکمه پرداخت */
.btn[data-loading] {
  pointer-events: none;
  opacity: 0.75;
}

.btn[data-loading]::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pay-spin 0.7s linear infinite;
}

@keyframes pay-spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------ ریسپانسیو */
@media (max-width: 960px) {
  .lic-plans {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin-inline: auto;
  }

  .plan-card.is-popular {
    transform: none;
  }

  .lic-features__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lic-features__grid {
    grid-template-columns: 1fr;
  }

  .lic-nav__brand small {
    display: none;
  }

  .checkout-done__meta {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    text-align: start;
  }

  .checkout-done__meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .modal__foot {
    flex-wrap: wrap;
  }

  .modal__foot .btn {
    flex: 1;
  }
}

/* ------------------------------------------------ ابزار مخفی (دکمه‌های مراحل مودال) */
.lic-body [hidden] {
  display: none !important;
}
