/* ==========================================================================
   Seen — Customer dashboard shell (dashboard / kyc / buy / history).
   Internal product surface: reuses brand tokens + form components from
   style.css/pages.css, mirrors the admin sidebar pattern so the whole
   product family feels consistent. No GSAP here — content renders
   instantly, loading is communicated with skeletons.
   ========================================================================== */
.dash-body { min-height: 100vh; display: flex; background: var(--off-white); }

/* Dashboard pages load no GSAP, so neutralize the marketing-site reveal
   classes (style.css hides them at opacity:0 until GSAP animates them in). */
.dash-body .reveal, .dash-body .reveal-stagger > * { opacity: 1; transform: none; }

/* ---------------- Sidebar ---------------- */
.dash-sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--ink-900); color: var(--white);
  display: flex; flex-direction: column;
  padding: 26px 18px;
  position: sticky; top: 0; height: 100vh;
}
.dash-sidebar .brand { margin-bottom: 8px; }
.dash-sidebar .subtitle { color: var(--ink-300); font-size: 12.5px; margin-bottom: 30px; }
.dash-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.dash-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  color: var(--ink-300); font-weight: 600; font-size: 14.5px;
  transition: background .2s, color .2s;
}
.dash-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.dash-nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.dash-nav a.active { background: var(--yellow-200); color: var(--ink-900); }
.dash-back-link {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-300); font-size: 13.5px; font-weight: 600;
  padding: 10px 14px; border-radius: 10px;
}
.dash-back-link:hover { color: var(--white); }
.dash-back-link svg { width: 15px; height: 15px; }
.dash-logout-btn {
  margin-top: 8px; width: 100%; justify-content: center;
  color: var(--ink-300); border: 1.5px solid rgba(255,255,255,.14);
}
.dash-logout-btn:hover { color: var(--white); border-color: rgba(255,255,255,.3); }

/* ---------------- Main column ---------------- */
.dash-main { flex: 1; padding: 40px; max-width: 1100px; min-width: 0; }
.dash-topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.dash-topbar h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.dash-topbar p { color: var(--ink-200); font-size: 14px; }
.dash-topbar .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.dash-panel { background: var(--white); border: 1px solid #ececec; border-radius: var(--radius-lg); padding: 26px; margin-bottom: 22px; }
.dash-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.dash-panel-head h2 { font-size: 17px; font-weight: 800; }
.dash-panel-head p { font-size: 13px; color: var(--ink-300); margin-top: 4px; }
.dash-panel-head .more-link { font-size: 13px; font-weight: 700; color: var(--yellow-600); white-space: nowrap; }

/* ---------------- Status chips (icon + text, never color alone) ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 100px;
  font-size: 12.5px; font-weight: 700; line-height: 1;
  background: var(--off-white); color: var(--ink-300); border: 1px solid #e8e8e8;
}
.chip svg { width: 13px; height: 13px; flex-shrink: 0; }
.chip.ok     { background: #eaf7ef; color: #1E8449; border-color: #cdebd8; }
.chip.warn   { background: #fdf3e2; color: #B9770E; border-color: #f5e1bd; }
.chip.danger { background: #fdeceb; color: #C0392B; border-color: #f5c6c2; }
.chip.muted  { background: var(--off-white); color: var(--ink-300); }

/* ---------------- Stat cards row ---------------- */
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.dash-stat-card {
  background: var(--white); border: 1px solid #ececec; border-radius: var(--radius-lg);
  padding: 20px 22px; display: flex; align-items: center; gap: 14px;
}
.dash-stat-card .ic {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: rgba(234,228,0,.14);
  display: flex; align-items: center; justify-content: center;
}
.dash-stat-card .ic svg { width: 21px; height: 21px; }
.dash-stat-card .lbl { font-size: 12.5px; color: var(--ink-300); font-weight: 600; margin-bottom: 5px; }
.dash-stat-card .val { font-size: 15.5px; font-weight: 800; color: var(--ink-800); }
.dash-stat-card .val.ltr { direction: ltr; unicode-bidi: isolate; text-align: right; display: inline-block; }

/* ---------------- Panel-access card (the centerpiece) ---------------- */
.panel-access {
  background: var(--ink-900); color: var(--white);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.panel-access::after {
  content: ""; position: absolute; inset-inline-start: -60px; top: -60px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(234,228,0,.16), transparent 70%);
  pointer-events: none;
}
.panel-access h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 9px; }
.panel-access h2 svg { width: 20px; height: 20px; color: var(--yellow-200); }
.panel-access .sub { color: var(--ink-300); font-size: 13.5px; margin-bottom: 20px; }
.cred-rows { display: grid; gap: 10px; margin-bottom: 20px; }
.cred-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 12px 16px;
}
.cred-row .k { font-size: 12.5px; color: var(--ink-300); font-weight: 600; min-width: 74px; }
.cred-row .v {
  flex: 1; font-size: 14.5px; font-weight: 700; color: var(--white);
  direction: ltr; unicode-bidi: isolate; text-align: left;
  overflow-wrap: anywhere; word-break: break-all;
}
.cred-btn {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.16); color: var(--ink-300);
  transition: background .2s, color .2s;
}
.cred-btn:hover { background: rgba(255,255,255,.1); color: var(--white); }
.cred-btn.copied { background: rgba(46,204,113,.2); color: #2ECC71; border-color: rgba(46,204,113,.4); }
.cred-btn svg { width: 15px; height: 15px; }
.panel-access .actions { display: flex; gap: 12px; flex-wrap: wrap; }

.panel-waiting { display: flex; align-items: flex-start; gap: 16px; }
.panel-waiting .ic {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
}
.panel-waiting .ic svg { width: 22px; height: 22px; color: var(--yellow-200); }
.panel-waiting .panel-waiting-body { flex: 1; min-width: 0; }
.panel-waiting p { color: var(--ink-300); font-size: 13.5px; line-height: 1.8; }
.panel-waiting b { color: var(--white); display: block; margin-bottom: 4px; font-size: 15px; }
.panel-waiting .btn { margin-top: 14px; }

/* ---------------- Notice banners ---------------- */
.dash-banner {
  display: flex; align-items: flex-start; gap: 13px;
  border-radius: 14px; padding: 16px 18px; margin-bottom: 22px;
  font-size: 13.5px; line-height: 1.8;
}
.dash-banner svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 3px; }
.dash-banner b { display: block; margin-bottom: 2px; font-size: 14.5px; }
.dash-banner .btn { margin-top: 10px; }
.dash-banner.warn   { background: #fdf3e2; color: #7a5308; border: 1px solid #f5e1bd; }
.dash-banner.danger { background: #fdeceb; color: #922B21; border: 1px solid #f5c6c2; }
.dash-banner.info   { background: rgba(234,228,0,.1); color: var(--ink-800); border: 1px solid rgba(216,210,0,.35); }

/* ---------------- Tables ---------------- */
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th {
  text-align: right; font-size: 12.5px; color: var(--ink-300); font-weight: 700;
  padding: 10px 14px; border-bottom: 1.5px solid #ececec; white-space: nowrap;
}
.dash-table td { padding: 13px 14px; border-bottom: 1px solid #f1f1f1; vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table .num { font-variant-numeric: tabular-nums; }

/* ---------------- Table pagination ---------------- */
.table-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid #f1f1f1;
}
.table-pager .pager-info { font-size: 13px; color: var(--ink-300); font-variant-numeric: tabular-nums; }
.pager-btn {
  font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-800);
  background: var(--white); border: 1.5px solid #e4e4e4; border-radius: var(--radius-sm);
  padding: 8px 18px; cursor: pointer; transition: border-color .2s, background .2s, color .2s;
}
.pager-btn:hover:not([disabled]) { border-color: var(--yellow-400); background: var(--off-white); }
.pager-btn[disabled] { opacity: .45; cursor: not-allowed; }

.dash-empty {
  text-align: center; padding: 44px 20px; color: var(--ink-300);
}
.dash-empty svg { width: 40px; height: 40px; margin-bottom: 12px; color: #d8d8d8; }
.dash-empty p { font-size: 14px; margin-bottom: 14px; }

/* ---------------- KYC page ---------------- */
.kyc-status-card { display: flex; align-items: flex-start; gap: 16px; }
.kyc-status-card .ic {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.kyc-status-card .ic svg { width: 23px; height: 23px; }
.kyc-status-card.ok .ic     { background: #eaf7ef; color: #1E8449; }
.kyc-status-card.warn .ic   { background: #fdf3e2; color: #B9770E; }
.kyc-status-card.danger .ic { background: #fdeceb; color: #C0392B; }
.kyc-status-card.muted .ic  { background: var(--off-white); color: var(--ink-300); }
.kyc-status-card b { font-size: 15.5px; display: block; margin-bottom: 4px; }
.kyc-status-card p { font-size: 13.5px; color: var(--ink-200); line-height: 1.8; }
.kyc-reject-reason {
  margin-top: 10px; background: #fdeceb; border: 1px solid #f5c6c2; color: #922B21;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}

.dropzone {
  border: 2px dashed #d9d9d9; border-radius: 14px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--yellow-600); background: rgba(234,228,0,.05); }
.dropzone svg { width: 34px; height: 34px; color: var(--ink-300); margin-bottom: 10px; }
.dropzone p { font-size: 14px; color: var(--ink-200); font-weight: 600; }
.dropzone span { display: block; font-size: 12px; color: var(--ink-300); margin-top: 6px; }
.dropzone.has-file { border-style: solid; border-color: #cdebd8; background: #f3faf6; }
.file-preview { display: flex; align-items: center; gap: 12px; justify-content: center; }
.file-preview img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e2e2; }
.file-preview .meta { text-align: right; }
.file-preview .meta b { display: block; font-size: 13.5px; overflow-wrap: anywhere; }
.file-preview .meta span { font-size: 12px; color: var(--ink-300); }
.field .err { display: none; font-size: 12.5px; color: #C0392B; margin-top: 6px; }
.field.invalid .err { display: block; }
.field.invalid input { border-color: #e6a19a; }

/* KYC identity-type switch (حقیقی / حقوقی) */
.kyc-type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.kyc-type-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 10px; border: 1.5px solid #e4e4e4; border-radius: var(--radius-sm);
  background: var(--white); cursor: pointer; text-align: center;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.kyc-type-opt b { font-size: 15px; font-weight: 800; color: var(--ink-800); }
.kyc-type-opt span { font-size: 12px; color: var(--ink-300); }
.kyc-type-opt:hover { border-color: var(--yellow-400); }
.kyc-type-opt.is-active { border-color: var(--yellow-500); background: rgba(234,228,0,.08); box-shadow: 0 0 0 3px var(--yellow-glow); }
.kyc-type-opt.is-active b { color: var(--ink-900); }
.kyc-type-tag {
  display: inline-block; margin-top: 8px; padding: 3px 11px; border-radius: 100px;
  font-size: 12px; font-weight: 700; background: var(--off-white); color: var(--ink-500);
}

/* ---------------- Buy page ---------------- */
.buy-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  align-content: flex-start;
}
.buy-tab {
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink-300);
  background: var(--white); border: 1.5px solid #e4e4e4; border-radius: 100px;
  padding: 9px 20px; cursor: pointer; transition: color .2s, border-color .2s, background .2s;
  white-space: nowrap;
}
.buy-tab:hover { color: var(--ink-800); border-color: #d2d2d2; }
.buy-tab.is-active { color: var(--ink-900); background: var(--yellow-200); border-color: var(--yellow-200); }

#buyPage .dash-topbar { margin-bottom: 12px; }
#buyPage .dash-topbar p { max-width: 52rem; line-height: 1.85; }
#buyPage #buyGate:not([hidden]) { margin-bottom: 14px; }

/* Buy page no longer uses <section>; keep marketing `section { padding: 120px 0 }`
   from wiping dashboard cards that are also <section> (e.g. .panel-access). */

.buy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.buy-card {
  background: var(--white); border: 1.5px solid #ececec; border-radius: var(--radius-lg);
  padding: 24px; display: flex; flex-direction: column; position: relative;
  transition: border-color .2s, box-shadow .2s;
}
.buy-card:hover { border-color: #dcdcdc; box-shadow: 0 10px 30px rgba(16,16,16,.05); }
.buy-card.featured { border-color: var(--yellow-600); }
.buy-card .badge {
  position: absolute; top: -11px; inset-inline-start: 20px;
  background: var(--yellow-200); color: var(--ink-900);
  font-size: 11.5px; font-weight: 800; padding: 4px 12px; border-radius: 100px;
}
.buy-card h3 { font-size: 16.5px; font-weight: 800; margin-bottom: 6px; }
.buy-card .desc { font-size: 13px; color: var(--ink-300); line-height: 1.8; margin-bottom: 14px; min-height: 40px; }
.buy-card .price { font-size: 24px; font-weight: 900; margin-bottom: 14px; }
.buy-card .price span { font-size: 12.5px; color: var(--ink-300); font-weight: 600; }
.buy-card ul { list-style: none; margin: 0 0 18px; padding: 0; flex: 1; }
.buy-card ul li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-200); padding: 5px 0; }
.buy-card ul li svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; }
.buy-success { text-align: center; padding: 30px 20px; }
.buy-success .ic {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: #eaf7ef; color: #1E8449;
  display: flex; align-items: center; justify-content: center;
}
.buy-success .ic svg { width: 30px; height: 30px; }
.buy-success h2 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.buy-success p { color: var(--ink-200); font-size: 14px; margin-bottom: 20px; line-height: 1.9; }
.buy-success .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------------- Messages / support inbox ---------------- */
.dash-msg-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.dash-msg-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow-y: auto; }
.dash-msg-item {
  text-align: right; width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--off-white); border: 1.5px solid transparent; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dash-msg-item:hover { border-color: rgba(216,210,0,.45); }
.dash-msg-item.active { background: rgba(234,228,0,.16); border-color: rgba(216,210,0,.55); }
.dash-msg-item .ttl { font-weight: 800; font-size: 14px; color: var(--ink-800); display: flex; align-items: center; gap: 8px; }
.dash-msg-item .meta { font-size: 12px; color: var(--ink-300); margin-top: 4px; }
.msg-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-900); flex-shrink: 0; }
.dash-msg-empty { color: var(--ink-300); font-size: 14px; padding: 40px 16px; text-align: center; }
.dash-msg-thread-panel .msg-thread { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.dash-msg-thread-panel .msg-bubble { padding: 12px 14px; border-radius: 12px; background: #f4f4f4; }
.dash-msg-thread-panel .msg-bubble.staff { background: rgba(234,228,0,.18); }
.dash-msg-thread-panel .msg-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-300); margin-bottom: 6px; }
.dash-msg-thread-panel .msg-body { font-size: 14px; line-height: 1.7; color: var(--ink-800); }
@media (max-width: 900px) {
  .dash-msg-layout { grid-template-columns: 1fr; }
}

/* ---------------- Skeleton loading ---------------- */
.skel { position: relative; overflow: hidden; background: #efefef; border-radius: 10px; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: skel-sweep 1.3s infinite;
}
@keyframes skel-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .dash-stats { grid-template-columns: 1fr; }
  .buy-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-body { flex-direction: column; }
  .dash-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; padding: 14px 16px; gap: 6px; }
  .dash-sidebar .subtitle, .dash-back-link span { display: none; }
  .dash-nav { flex-direction: row; flex: none; }
  .dash-nav a { padding: 10px 12px; white-space: nowrap; }
  .dash-logout-btn { margin: 0 0 0 auto; width: auto; }
  .dash-main { padding: 24px 16px; }
  .cred-row { flex-wrap: wrap; }
}
