/* ==========================================================================
   Croplod Plus — Reading Rewards (باشگاه خوانندگان) + reveal modal
   ========================================================================== */
.rr-page {
  --rr-accent: #6d28d9;
  --rr-accent-2: #a78bfa;
  --rr-gold: #d97706;
  --rr-ink: #101828;
  --rr-ink-2: #475467;
  --rr-muted: #8a94a6;
  --rr-bg: #ffffff;
  --rr-bg-soft: #f7f6fb;
  --rr-line: #e7e4f0;
  --rr-line-2: #d7d2e6;
  --rr-ok: #12805c;
  --rr-ok-soft: rgba(18, 128, 92, .1);
  --rr-warn: #b45309;
  --rr-warn-soft: rgba(180, 83, 9, .1);
  --rr-bad: #c8102e;
  --rr-bad-soft: rgba(200, 16, 46, .08);
  --rr-shadow: 0 1px 2px rgba(16,24,40,.05), 0 14px 40px -22px rgba(16,24,40,.25);
  --rr-r: 16px;
  color: var(--rr-ink);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 26px) 60px;
}
[data-theme="dark"] .rr-page {
  --rr-accent: #a78bfa;
  --rr-accent-2: #c4b5fd;
  --rr-ink: #ece9f5;
  --rr-ink-2: #b8b3c9;
  --rr-muted: #8f8aa3;
  --rr-bg: #14121c;
  --rr-bg-soft: #100e17;
  --rr-line: #2b2739;
  --rr-line-2: #3a344c;
  --rr-ok: #34d399;
  --rr-ok-soft: rgba(52, 211, 153, .14);
  --rr-warn: #fbbf24;
  --rr-warn-soft: rgba(251, 191, 36, .14);
  --rr-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ---------- shell ---------- */
.rr-shell { display: grid; grid-template-columns: 252px 1fr; gap: 22px; align-items: start; }
.rr-side {
  position: sticky; top: calc(var(--header-height, 74px) + 16px);
  background: var(--rr-bg); border: 1px solid var(--rr-line); border-radius: 18px;
  padding: 16px; box-shadow: var(--rr-shadow);
}
.rr-side-brand { display: flex; gap: 10px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--rr-line); }
.rr-side-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rr-accent), #4c1d95); color: #fff; font-size: 19px;
  box-shadow: 0 8px 20px -10px rgba(109,40,217,.7);
}
.rr-side-brand-txt { display: flex; flex-direction: column; gap: 2px; }
.rr-side-brand-txt b { font-size: 13px; }
.rr-side-brand-txt span { font-size: 10.5px; color: var(--rr-muted); }
.rr-side-profile { display: flex; flex-direction: column; gap: 4px; padding: 12px 4px; }
.rr-side-level { font-size: 12px; font-weight: 900; color: var(--lv, var(--rr-accent)); }
.rr-side-count { font-size: 11px; color: var(--rr-muted); }
.rr-nav { display: grid; gap: 3px; }
.rr-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: var(--rr-ink-2); text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.rr-nav-link svg { width: 18px; height: 18px; flex: none; opacity: .82; }
.rr-nav-link:hover { background: var(--rr-bg-soft); color: var(--rr-ink); }
.rr-nav-link.active { background: color-mix(in srgb, var(--rr-accent) 12%, transparent); color: var(--rr-accent); }
.rr-side-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rr-line); }
.rr-side-foot a { font-size: 11.5px; color: var(--rr-muted); text-decoration: none; }
.rr-side-foot a:hover { color: var(--rr-accent); }
.rr-main { min-width: 0; }

/* ---------- head ---------- */
.rr-welcome {
  display: flex; gap: 16px; align-items: center; margin-bottom: 18px; padding: 20px 22px;
  border-radius: 18px; background: linear-gradient(120deg, #1b1033, #3b1d6e); color: #fff;
  border: 1px solid rgba(196, 181, 253, .3); box-shadow: 0 20px 50px -30px rgba(76, 29, 149, .8);
}
.rr-welcome-mark {
  width: 52px; height: 52px; border-radius: 15px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: linear-gradient(135deg, #a78bfa, #6d28d9);
  box-shadow: 0 12px 30px -12px rgba(167, 139, 250, .9);
}
.rr-welcome h2 { margin: 0 0 6px; font-size: 17px; font-weight: 900; }
.rr-welcome p { margin: 0; font-size: 12.5px; line-height: 1.9; color: #d7cff0; }
.rr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.rr-kicker { font-size: 11.5px; font-weight: 800; color: var(--rr-accent); letter-spacing: .02em; }
.rr-title { font-size: clamp(20px, 2.6vw, 28px); font-weight: 900; margin: 6px 0 4px; line-height: 1.4; }
.rr-sub { color: var(--rr-muted); font-size: 13px; margin: 0; }
.rr-head-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 900;
  color: var(--lv, var(--rr-accent)); background: color-mix(in srgb, var(--lv, #6d28d9) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--lv, #6d28d9) 35%, transparent);
  border-radius: 999px; padding: 8px 15px;
}
.rr-head-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- kpis ---------- */
.rr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.rr-kpi { background: var(--rr-bg); border: 1px solid var(--rr-line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.rr-kpi-accent { background: linear-gradient(160deg, color-mix(in srgb, var(--rr-accent) 14%, transparent), transparent); border-color: color-mix(in srgb, var(--rr-accent) 30%, var(--rr-line)); }
.rr-kpi-label { font-size: 11.5px; color: var(--rr-muted); font-weight: 700; }
.rr-kpi-value { font-size: clamp(20px, 2.4vw, 26px); font-weight: 900; line-height: 1.3; }
.rr-kpi-accent .rr-kpi-value { color: var(--rr-accent); }
.rr-kpi-value small { font-size: 12px; font-weight: 700; color: var(--rr-muted); }
.rr-kpi-hint { font-size: 11px; color: var(--rr-muted); }

/* ---------- cards ---------- */
.rr-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.rr-card { background: var(--rr-bg); border: 1px solid var(--rr-line); border-radius: var(--rr-r); padding: 16px 18px; margin-bottom: 16px; }
.rr-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.rr-card-title { font-size: 14px; font-weight: 800; margin: 0; }
.rr-link { color: var(--rr-accent); font-size: 12.5px; font-weight: 800; text-decoration: none; }
.rr-link:hover { text-decoration: underline; }

/* level */
.rr-level-body { display: flex; align-items: center; gap: 20px; }
.rr-ring {
  width: 118px; height: 118px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center;
  background: conic-gradient(var(--lv, var(--rr-accent)) calc(var(--p) * 1%), var(--rr-line) 0);
}
.rr-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--rr-bg); }
.rr-ring span { position: relative; z-index: 1; font-size: 21px; font-weight: 900; color: var(--rr-ink); }
.rr-level-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rr-level-name { font-size: 16px; font-weight: 900; }
.rr-level-count { font-size: 12.5px; color: var(--rr-ink-2); }
.rr-level-next { font-size: 11.5px; color: var(--rr-muted); line-height: 1.7; }
.rr-level-ladder { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--rr-line); }
.rr-ladder-dot { width: 100%; height: 6px; border-radius: 3px; background: var(--rr-line); }
.rr-ladder-dot.on { background: var(--lv, var(--rr-accent)); }

/* bars */
.rr-bars { display: flex; align-items: flex-end; gap: 7px; height: 130px; }
.rr-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.rr-bar {
  width: 100%; max-width: 28px; min-height: 3px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--rr-accent), var(--rr-accent-2));
  transition: height .4s ease;
}
.rr-bar-x { font-size: 8.5px; color: var(--rr-muted); white-space: nowrap; }

/* heatmap */
.rr-heat { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.rr-heat-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--rr-bg-soft); border: 1px solid var(--rr-line); display: inline-block; }
.rr-heat-0 { background: color-mix(in srgb, var(--rr-line) 55%, transparent); }
.rr-heat-1 { background: color-mix(in srgb, var(--rr-accent) 25%, transparent); }
.rr-heat-2 { background: color-mix(in srgb, var(--rr-accent) 45%, transparent); }
.rr-heat-3 { background: color-mix(in srgb, var(--rr-accent) 70%, transparent); }
.rr-heat-4 { background: var(--rr-accent); }
.rr-heat-legend { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 10.5px; color: var(--rr-muted); }
.rr-heat-legend .rr-heat-cell { width: 11px; height: 11px; }
.rr-mini-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rr-line); font-size: 12px; color: var(--rr-muted); }
.rr-mini-stats b { color: var(--rr-ink); }

/* categories */
.rr-cats { display: grid; gap: 12px; }
.rr-cat-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.rr-cat-name { font-weight: 700; color: var(--rr-ink); }
.rr-cat-n { color: var(--rr-muted); font-weight: 800; }
.rr-cat-bar { height: 8px; border-radius: 999px; background: var(--rr-bg-soft); overflow: hidden; border: 1px solid var(--rr-line); }
.rr-cat-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rr-accent), var(--rr-accent-2)); }

/* table */
.rr-table-wrap { overflow-x: auto; }
.rr-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rr-table th { text-align: right; font-size: 11px; color: var(--rr-muted); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--rr-line); white-space: nowrap; }
.rr-table td { padding: 11px 10px; border-bottom: 1px solid var(--rr-line); vertical-align: middle; }
.rr-table tr:last-child td { border-bottom: none; }
.rr-table tr:hover td { background: var(--rr-bg-soft); }
.rr-td-title a { color: var(--rr-ink); text-decoration: none; font-weight: 700; }
.rr-td-title a:hover { color: var(--rr-accent); }
.rr-td-strong { font-weight: 900; color: var(--rr-accent); white-space: nowrap; }
.rr-muted { color: var(--rr-muted); white-space: nowrap; }
.rr-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; background: var(--rr-bg-soft); color: var(--rr-muted); }
.rr-pill-confirmed, .rr-pill-paid { background: var(--rr-ok-soft); color: var(--rr-ok); }
.rr-pill-pending, .rr-pill-approved { background: var(--rr-warn-soft); color: var(--rr-warn); }
.rr-pill-rejected { background: var(--rr-bad-soft); color: var(--rr-bad); }
.rr-empty { color: var(--rr-muted); font-size: 13.5px; padding: 22px 0; text-align: center; }

/* form */
.rr-form { display: grid; gap: 12px; }
.rr-field { display: flex; flex-direction: column; gap: 6px; }
.rr-field label { font-size: 12.5px; font-weight: 800; }
.rr-input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--rr-ink);
  background: var(--rr-bg-soft); border: 1px solid var(--rr-line-2); border-radius: 10px; padding: 10px 12px; outline: none;
}
.rr-input:focus { border-color: var(--rr-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rr-accent) 18%, transparent); }
.rr-help { font-size: 11px; color: var(--rr-muted); margin: 0; }
.rr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 11px 20px; font-family: inherit; font-size: 13px; font-weight: 800; cursor: pointer; text-decoration: none; }
.rr-btn-primary { background: var(--rr-accent); color: #fff; box-shadow: 0 10px 24px -12px rgba(109,40,217,.7); }
.rr-btn-primary:hover { filter: brightness(1.08); }
.rr-btn[disabled] { opacity: .5; cursor: not-allowed; }
.rr-formula { background: var(--rr-bg-soft); border: 1px dashed var(--rr-line-2); border-radius: 12px; padding: 13px 16px; font-size: 12.5px; color: var(--rr-ink-2); line-height: 1.9; margin-bottom: 16px; }
.rr-flash-wrap { display: grid; gap: 8px; margin-bottom: 14px; }
.rr-flash { border-radius: 10px; padding: 12px 14px; font-size: 13px; font-weight: 600; background: var(--rr-bg-soft); border: 1px solid var(--rr-line); }
.rr-flash-success { background: var(--rr-ok-soft); color: var(--rr-ok); border-color: transparent; }
.rr-flash-error, .rr-flash-danger { background: var(--rr-bad-soft); color: var(--rr-bad); border-color: transparent; }

/* ---------- reveal modal ---------- */
.rr-modal-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 6, 16, .6); backdrop-filter: blur(6px); padding: 20px;
  opacity: 0; animation: rr-fade .35s ease forwards;
}
@keyframes rr-fade { to { opacity: 1; } }
.rr-modal-card {
  position: relative; width: min(440px, 100%); border-radius: 24px;
  background: linear-gradient(165deg, #1b1033, #2a1650 55%, #3b1d6e);
  color: #fff; padding: 34px 28px 26px; text-align: center;
  box-shadow: 0 40px 90px -30px rgba(76, 29, 149, .8);
  border: 1px solid rgba(196, 181, 253, .28);
  transform: translateY(14px) scale(.97); animation: rr-pop .4s cubic-bezier(.2,.9,.3,1.2) forwards;
}
@keyframes rr-pop { to { transform: none; } }
.rr-modal-mark {
  width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  box-shadow: 0 16px 40px -14px rgba(167,139,250,.9);
}
.rr-modal-kicker { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #c4b5fd; text-transform: uppercase; }
.rr-modal-title { font-size: 23px; font-weight: 900; margin: 8px 0 8px; line-height: 1.4; }
.rr-modal-text { font-size: 13.5px; line-height: 2; color: #d7cff0; margin: 0 0 20px; }
.rr-modal-text b { color: #fff; }
.rr-modal-actions { display: grid; gap: 9px; }
.rr-modal-btn {
  display: block; text-align: center; border-radius: 13px; padding: 13px 18px;
  font-size: 14px; font-weight: 900; text-decoration: none; cursor: pointer; border: none; font-family: inherit;
}
.rr-modal-btn-primary { background: #a78bfa; color: #1b1033; }
.rr-modal-btn-primary:hover { background: #c4b5fd; }
.rr-modal-btn-ghost { background: rgba(255,255,255,.08); color: #d7cff0; }
.rr-modal-close {
  position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #d7cff0;
  font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.rr-modal-stats { display: flex; justify-content: center; gap: 18px; margin: 4px 0 18px; }
.rr-modal-stat { display: flex; flex-direction: column; gap: 2px; }
.rr-modal-stat b { font-size: 20px; font-weight: 900; }
.rr-modal-stat span { font-size: 10.5px; color: #b9aede; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .rr-shell { grid-template-columns: 1fr; }
  .rr-side { position: static; }
  .rr-grid-2 { grid-template-columns: 1fr; }
  .rr-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .rr-kpis { grid-template-columns: 1fr 1fr; }
  .rr-level-body { flex-direction: column; align-items: flex-start; }
}
