/* ============================================================
   صفحهٔ خرید/ارتقای اشتراک — استایل اختصاصی
   منظم و یکدست با سیستم طراحیِ app.css (سازگار با CSP، بدون اینلاین‌استایل)
   ============================================================ */

/* ---------- ابزارها ---------- */
.hidden{display:none}
.plans-loading{padding:22px; text-align:center; color:var(--muted)}

/* ============================================================
   باکس مصرف فعلی
   ============================================================ */
.usage-box{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); padding:18px 20px; margin-bottom:18px;
}
.usage-box-header{display:flex; align-items:center; justify-content:space-between;
  margin-bottom:16px; flex-wrap:wrap; gap:8px}
.usage-box-badge{display:inline-flex; align-items:center; gap:7px; font-size:12px; font-weight:700;
  padding:5px 12px; border-radius:99px; background:var(--accent-soft); color:var(--accent)}
.usage-box-badge.base-plan{background:var(--surface-2); color:var(--muted)}
.usage-box-badge .dot{width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0}
.usage-box-exp{font-size:11.5px; color:var(--muted)}
.usage-bar-row{display:flex; align-items:center; gap:12px; margin-bottom:8px}
.usage-bar-row:last-child{margin-bottom:0}
.usage-bar-label{font-size:12px; color:var(--muted); min-width:90px; white-space:nowrap}
.usage-bar-bg{flex:1; height:6px; background:var(--surface-2); border-radius:99px; overflow:hidden}
.usage-bar-fg{height:100%; border-radius:99px; background:var(--grad-2); min-width:3px; transition:width .4s}
.usage-bar-fg.warn{background:linear-gradient(90deg,var(--warn),var(--err))}
.usage-bar-val{font-size:11.5px; color:var(--muted); min-width:84px; text-align:left; white-space:nowrap}
.usage-bar-sub{font-size:10px; color:var(--faint); padding-right:102px; margin-top:-4px; margin-bottom:8px}

/* ============================================================
   باکس کشویی کد تخفیف
   ============================================================ */
.disc-card{padding:0; overflow:hidden}
.disc-toggle{
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:15px 20px; background:none; border:none; cursor:pointer;
  font-family:inherit; color:var(--ink); user-select:none; text-align:start;
}
.disc-toggle-label{display:flex; align-items:center; gap:9px; font-size:13px; font-weight:600; color:var(--muted)}
.disc-ic{opacity:.6; flex-shrink:0}
.disc-chevron{flex-shrink:0; opacity:.5; transition:transform .2s}
.disc-card.open .disc-chevron{transform:rotate(180deg)}
.disc-body{display:none; padding:0 20px 18px; border-top:1px solid var(--line)}
.disc-card.open .disc-body{display:block}
.disc-input-row{display:flex; gap:8px; margin-top:14px}
.disc-input{
  flex:1; min-width:0; box-sizing:border-box; padding:10px 14px;
  border:1.5px solid var(--line); border-radius:var(--radius-xs);
  background:var(--surface-2); color:var(--ink);
  font-family:inherit; font-size:14px; text-transform:uppercase; letter-spacing:1px;
  direction:ltr; text-align:left; outline:none; transition:border-color .15s;
}
.disc-input::placeholder{letter-spacing:0; text-align:right; direction:rtl; color:var(--faint)}
.disc-input:focus{border-color:var(--accent)}
#applyDiscountBtn{white-space:nowrap; padding:10px 20px}
#applyDiscountBtn.dc-applied{background:var(--accent-soft); color:var(--ok)}
.disc-status{font-size:13px; margin-top:10px; display:none}
.disc-status.show{display:block}
.disc-ok{color:var(--ok); font-weight:600}
.disc-err{color:var(--err); font-weight:600}

/* ============================================================
   طرح‌های اشتراک
   ============================================================ */
.plans-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:16px; margin-top:6px}
.plan-card{
  display:flex; flex-direction:column;
  background:var(--surface-2); border:1.5px solid var(--line); border-radius:var(--radius-sm);
  padding:22px 20px; position:relative; cursor:pointer;
  transition:border-color .2s, transform .2s, box-shadow .2s;
}
.plan-card:hover{border-color:var(--accent-line); transform:translateY(-2px)}
.plan-card.active-plan{border-color:var(--accent); background:var(--accent-soft); cursor:default}
.plan-card.selected{border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft)}
.plan-card.plan-locked{opacity:.6; cursor:not-allowed}
.plan-card.plan-locked:hover{transform:none; border-color:var(--line)}

.plan-name{font-size:16px; font-weight:800; color:var(--ink); margin-bottom:4px}
.plan-price{font-size:22px; font-weight:900; color:var(--accent); margin:8px 0 12px; line-height:1.3}
.plan-price small{font-size:12.5px; font-weight:500; color:var(--muted)}
.price-old{text-decoration:line-through; color:var(--muted); font-size:14px; font-weight:600}
.price-new{color:var(--ok); font-weight:800}
.plan-price-old{text-decoration:line-through; color:var(--muted); font-size:15px; font-weight:600; margin-inline-end:6px}

.plan-detail{font-size:12.5px; color:var(--muted); margin:5px 0; display:flex; gap:7px; align-items:center}
.plan-detail svg{flex-shrink:0; opacity:.8}
.plan-feature{align-items:flex-start}
.plan-feature svg{margin-top:3px; color:var(--accent); opacity:1}
.plan-feature b{color:var(--ink); font-weight:700}
.plan-desc{font-size:12.5px; color:var(--faint); margin-top:10px; line-height:1.8;
  padding-top:10px; border-top:1px solid var(--line)}

/* بلوک مابه‌التفاوت ارتقا */
.plan-upgrade-block{display:flex; flex-direction:column; gap:2px; margin:6px 0 10px;
  padding:10px 12px; background:var(--accent-soft); border-radius:var(--radius-xs)}
.plan-upgrade-label{font-size:11px; font-weight:700; color:var(--accent-strong); letter-spacing:.2px}
.plan-upgrade-price{font-size:18px; font-weight:900; color:var(--accent); line-height:1.3}
.plan-upgrade-hint{font-size:11px; color:var(--faint); font-weight:400}
.upg-old{text-decoration:line-through; color:var(--muted); font-size:12px}

/* نشانِ صرفه‌جویی تخفیف */
.plan-discount-badge{display:none; margin:4px 0 8px; font-size:12px; color:var(--ok); font-weight:600}
.plan-discount-badge.show{display:block}

.badge-active{position:absolute; top:12px; left:12px; background:var(--grad-2); color:#04221A;
  font-size:11px; font-weight:700; padding:3px 10px; border-radius:99px}
.plan-btn{width:100%; margin-top:auto; padding-top:11px; padding-bottom:11px}
.plan-btn:disabled{opacity:.5; cursor:not-allowed}
.plan-card.plan-locked .plan-btn{background:var(--surface-3); color:var(--muted)}

/* ============================================================
   وضعیت پرداخت (بازگشت از درگاه)
   ============================================================ */
.pay-status{padding:26px 24px; border-radius:var(--radius); margin-bottom:18px; text-align:center}
.pay-status.success{background:var(--accent-soft); border:1px solid var(--accent-line)}
.pay-status.failed{background:rgba(239,68,68,.1); border:1px solid rgba(239,68,68,.3)}
.pay-status h2{font-size:19px; font-weight:800; margin:0 0 8px; color:var(--ink)}
.pay-status p{font-size:13.5px; color:var(--muted); line-height:1.8}
.pay-ref{margin-top:8px; font-size:12px; color:var(--faint)}

/* ============================================================
   تاریخچهٔ پرداخت
   ============================================================ */
.tbl-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:var(--radius-sm)}
.history-tbl{width:100%; border-collapse:collapse; font-size:12.5px; min-width:520px}
.history-tbl th{text-align:right; padding:11px 12px; border-bottom:1.5px solid var(--line);
  color:var(--muted); font-weight:700; font-size:11.5px; white-space:nowrap}
.history-tbl td{padding:11px 12px; border-bottom:1px solid var(--line); vertical-align:middle}
.history-tbl tbody tr:last-child td{border-bottom:none}
.hist-date{font-size:11.5px; color:var(--muted); white-space:nowrap}

.status-pill{display:inline-block; padding:3px 10px; border-radius:99px; font-size:11px; font-weight:700; white-space:nowrap}
.status-pill.paid{background:var(--accent-soft); color:var(--ok)}
.status-pill.pending{background:rgba(245,158,11,.15); color:var(--warn)}
.status-pill.failed{background:rgba(239,68,68,.15); color:var(--err)}
.status-pill.cancelled{background:var(--surface-3); color:var(--muted)}

/* صفحه‌بندی تاریخچه */
.hist-pager{display:flex; align-items:center; justify-content:center; gap:10px;
  margin-top:18px; padding-bottom:2px; flex-wrap:wrap}
.hist-pager-btn{display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; padding:0; background:var(--surface-2);
  border:1.5px solid var(--line); border-radius:var(--radius-xs); color:var(--ink);
  cursor:pointer; transition:background .15s, border-color .15s; flex-shrink:0}
.hist-pager-btn:hover:not(:disabled){background:var(--surface-3); border-color:var(--accent-line)}
.hist-pager-btn:disabled{opacity:.4; cursor:not-allowed}
.hist-pager-info{font-size:12px; color:var(--muted); font-weight:600; white-space:nowrap}
