/* ─────────────────────────────────────────────────────────────────────────
   Pro My Account – Global design system
   Shared tokens + style presets. Loaded on every plugin surface.
   Everything is scoped to .pma-scope / .pma-dashboard so no theme element
   can inherit from here.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Shape + surface scale ────────────────────────────────────────────────
   One soft-corner scale for every surface the plugin renders: small enough
   to stay crisp and premium, never pill-round. Page canvases sit on a faint
   brand-tinted off-white so white cards and panels separate clearly.
   ──────────────────────────────────────────────────────────────────────── */
:root {
  --pma-r-xs: 4px;
  --pma-r-sm: 6px;
  --pma-r-md: 8px;
  --pma-r-lg: 12px;
  --pma-r-xl: 16px;
  --pma-canvas: #f6f4f8;
}

/* ── Shared tokens (preset: elegant / شیک) ───────────────────────────────── */
.pma-scope,
.pma-dashboard {
  --pma-radius-card:    12px !important;
  --pma-radius-control: 8px !important;
  --pma-radius-pill:    999px !important;
  --pma-radius-media:   8px !important;
  --s-radius:           12px !important;
  --s-control:          8px !important;
  --pma-radius:         12px !important;
  --pma-radius-sm:      8px !important;

  --pma-card-border:    1px solid var(--pma-border, #e5e7eb);
  --pma-card-shadow:    0 1px 3px rgba(0,0,0, 0.04);
  --pma-card-shadow-hv: 0 4px 12px rgba(0,0,0, 0.08);

  --pma-gap:            20px;
  --pma-gap-sm:         14px;
  --pma-pad-card:       20px;

  --pma-ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --pma-speed:          0.28s;
  --pma-lift:           -2px;

  --pma-ok:             #7c1695;
  --pma-warn:           #8f6d43;
  --pma-danger:         #8f6d43;
  --pma-info:           #7c1695;
}

/* ── Preset: modern / مدرن — clean, softly rounded ─────────────────── */
.pma-scope.pma-style-modern,
.pma-dashboard.pma-style-modern {
  --pma-radius-card:    12px !important;
  --pma-radius-control: 8px !important;
  --pma-radius-pill:    999px !important;
  --pma-radius-media:   8px !important;
  --s-radius:           12px !important;
  --s-control:          8px !important;
  --pma-radius:         12px !important;
  --pma-radius-sm:      8px !important;

  --pma-card-border:    1px solid rgba(17,24,39, 0.08);
  --pma-card-shadow:    0 1px 3px rgba(17,24,39, 0.04);
  --pma-card-shadow-hv: 0 4px 16px rgba(17,24,39, 0.08);

  --pma-gap:            24px;
  --pma-gap-sm:         16px;
  --pma-pad-card:       24px;

  --pma-speed:          0.25s;
  --pma-lift:           -2px;
}

/* Soft-corner styling applied to the shared component vocabulary. */
.pma-style-modern .pma-btn-primary,
.pma-style-modern .pma-btn-primary-sm,
.pma-style-modern .pma-btn-sm,
.pma-style-modern .pma-btn-ghost,
.pma-style-modern .pma-btn-secondary,
.pma-style-modern .pma-btn-lg,
.pma-style-modern .pma-input,
.pma-style-modern .pma-select,
.pma-style-modern .pma-textarea,
.pma-style-modern .pma-quick-btn {
  border-radius: var(--pma-r-md) !important;
}

.pma-style-modern .pma-btn-primary,
.pma-style-modern .pma-btn-primary-sm {
  box-shadow: 0 2px 8px var(--pma-brand-ring);
}

.pma-style-modern .pma-btn-primary:hover,
.pma-style-modern .pma-btn-primary-sm:hover {
  box-shadow: 0 4px 14px var(--pma-brand-glow);
}

.pma-style-modern .pma-stat-card,
.pma-style-modern .pma-quick-access,
.pma-style-modern .pma-recent-orders,
.pma-style-modern .pma-notification-widget,
.pma-style-modern .pma-order-card,
.pma-style-modern .pma-course-card,
.pma-style-modern .pma-download-card,
.pma-style-modern .pma-card,
.pma-style-modern .pma-tickets-table,
.pma-style-modern .pma-chat-wrap,
.pma-style-modern .pma-order-detail-panel,
.pma-style-modern .pma-empty-state,
.pma-style-modern .pma-empty,
.pma-style-modern .pma-panel,
.pma-style-modern .pma-prompt,
.pma-style-modern .pma-related-card {
  border: var(--pma-card-border);
  border-radius: var(--pma-r-md) !important;
  box-shadow: var(--pma-card-shadow);
}

.pma-style-modern .pma-stat-icon,
.pma-style-modern .pma-line-media,
.pma-style-modern .pma-order-thumb,
.pma-style-modern .pma-avatar,
.pma-style-modern .pma-review-thumb img,
.pma-style-modern .pma-related-media {
  border-radius: var(--pma-r-md) !important;
  overflow: hidden;
}

.pma-style-modern .pma-status-badge,
.pma-style-modern .pma-priority-badge,
.pma-style-modern .pma-order-stage-badge,
.pma-style-modern .pma-badge,
.pma-style-modern .pma-stock-note,
.pma-style-modern .pma-related-badge {
  border-radius: var(--pma-r-md) !important;
}

.pma-style-modern .pma-stepper,
.pma-style-modern .pma-coupon,
.pma-style-modern .pma-toast,
.pma-style-modern .pma-toast-item {
  border-radius: var(--pma-r-md) !important;
}

.pma-style-modern .pma-input,
.pma-style-modern .pma-select,
.pma-style-modern .pma-textarea {
  padding: 12px 14px;
  background: var(--pma-surface);
  border-color: rgba(17,24,39, 0.14);
  border-radius: var(--pma-r-md) !important;
}

/* ── Sidebar character per preset ────────────────────────────────────────
   The sidebar layout itself lives in pro-myaccount.css and is written
   against the radius tokens. What differs between the presets is posture:
   "شیک" is an editorial column – a brand block flush to the edges and
   full-bleed rows marked by a hard rail; "مدرن" floats an inset card above
   rounded pills. Both stay tidy; neither is a rounded copy of the other.
   ──────────────────────────────────────────────────────────────────────── */

/* Elegant / شیک — soft corners, full bleed. */
.pma-style-elegant .pma-side-head { padding: 12px 14px 6px; }

.pma-style-elegant .pma-profile-card {
  padding: 12px 14px;
  border: 1px solid var(--pma-border);
}

.pma-style-elegant .pma-nav { padding-inline: 0; }
.pma-style-elegant .pma-nav-group-title { padding-inline: 18px; }
.pma-style-elegant .pma-nav-item { padding-inline: 18px; }
.pma-style-elegant .pma-nav-group + .pma-nav-group { margin-top: 10px; padding-top: 10px; }

/* The rail sits on the outer edge of the column, where a printed rule would. */
.pma-style-elegant .pma-nav-item.active::before {
  content: '';
  display: block;
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--pma-brand);
}

.pma-style-elegant .pma-side-foot { padding-inline: 0; }
.pma-style-elegant .pma-side-foot .pma-nav-item { padding-block: 11px; }

/* Modern / مدرن — the identity card floats, the rows become pills. */
.pma-style-modern .pma-profile-card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--pma-border);
}

.pma-style-modern .pma-nav-item { padding: 9px 12px; }
.pma-style-modern .pma-nav-group { gap: 3px; }

/* Spacing carries the grouping here; a hairline would fight the soft edges.
   Without a rule between them the groups need more air, or a heading reads
   as one more row rather than as a break. */
.pma-style-modern .pma-nav-group + .pma-nav-group {
  margin-top: 18px;
  padding-top: 0;
  border-top: none;
}

.pma-style-modern .pma-side-foot { padding: 12px 10px; }

/* ── Readable text on the brand colour ───────────────────────────────────
   --pma-on-brand is computed from the brand colour's WCAG luminance, so a
   light brand (yellow, mint, pastel) automatically flips to dark text. */
.pma-scope .pma-btn-primary,
.pma-scope .pma-btn-primary-sm,
.pma-scope .pma-ui-btn--primary,
.pma-scope .pma-ui-btn--dark,
.pma-scope .checkout-button,
.pma-scope button#place_order,
.pma-scope .pma-paybar-btn,
.pma-scope .pma-modal-ok,
.pma-scope .pma-badge,
.pma-scope .pma-related-badge,
.pma-scope .pma-review-thumb .product-quantity,
.pma-scope .pma-step.is-current .pma-step-dot,
.pma-scope .pma-ord-tab.is-active .pma-ord-count,
.pma-scope .pma-ord-qty,
.pma-dashboard .pma-btn-primary,
.pma-dashboard .pma-btn-primary-sm,
.pma-dashboard .pma-btn-sm:not(.pma-btn-ghost):not(.pma-addr-delete):not(.pma-dismiss-notification):not(.pma-btn-danger):hover,
.pma-dashboard .pma-badge,
.pma-dashboard .pma-ord-tab.is-active .pma-ord-count,
.pma-dashboard .pma-ord-qty,
.pma-dashboard .pma-course-cta,
.pma-dashboard .pma-download-btn:hover,
.pma-dashboard .pma-copy-btn.copied,
.pma-dashboard .pma-cart-update.is-active {
  color: var(--pma-on-brand, #fff) !important;
}

/* Tints of the brand need their own readable foreground. */
.pma-scope .pma-hero-kicker,
.pma-scope .pma-panel-num,
.pma-scope .pma-prompt-icon,
.pma-dashboard .pma-stat-icon.courses {
  color: var(--pma-on-brand-light, var(--pma-brand)) !important;
}

/* ── Focus states (both presets) ─────────────────────────────────────────── */
.pma-scope :focus-visible,
.pma-dashboard :focus-visible {
  outline: 2px solid var(--pma-brand);
  outline-offset: 2px;
}

.pma-scope .pma-input:focus,
.pma-scope .pma-select:focus,
.pma-scope .pma-textarea:focus,
.pma-dashboard .pma-input:focus,
.pma-dashboard .pma-select:focus,
.pma-dashboard .pma-textarea:focus {
  border-color: var(--pma-brand);
  box-shadow: 0 0 0 3px var(--pma-brand-ring);
}

/* ── Motion preferences ──────────────────────────────────────────────────── */
.pma-no-anim,
.pma-no-anim *,
.pma-no-anim *::before,
.pma-no-anim *::after {
  animation: none !important;
  transition: none !important;
}

.pma-no-anim .pma-stat-card:hover,
.pma-no-anim .pma-order-card:hover,
.pma-no-anim .pma-course-card:hover,
.pma-no-anim .pma-quick-btn:hover,
.pma-no-anim .pma-btn-primary:hover,
.pma-no-anim .pma-ui-btn:hover,
.pma-no-anim .pma-related-card:hover {
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .pma-scope,
  .pma-scope *,
  .pma-scope *::before,
  .pma-scope *::after,
  .pma-dashboard,
  .pma-dashboard *,
  .pma-dashboard *::before,
  .pma-dashboard *::after,
  .pma-toast {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── LTR corrections for the shared components ───────────────────────────── */
.pma-scope.pma-ltr,
.pma-scope.pma-ltr *,
.pma-dashboard.pma-ltr,
.pma-dashboard.pma-ltr * {
  direction: ltr;
}

/* The sidebar needs no LTR corrections any more: its edges, alignment,
   active rail and badge placement are all written as logical properties,
   so it mirrors on its own. */

/* ── Money typography ────────────────────────────────────────────────────
   The currency word (تومان / ریال) is a unit, not part of the number, so it
   drops a step in size and weight everywhere the plugin prints a price. Sizes
   are relative (em) so this holds from a 12px line item up to the 22px cart
   total without a single per-component override.
   ──────────────────────────────────────────────────────────────────────── */

.pma-scope .woocommerce-Price-currencySymbol,
.pma-dashboard .woocommerce-Price-currencySymbol {
  display: inline-block;
  margin-inline-start: .28em;
  font-size: .68em;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  opacity: .72;
  vertical-align: baseline;
}

/* Struck-through "before" prices are already small; shrinking the unit again
   would make it unreadable. */
.pma-scope del .woocommerce-Price-currencySymbol,
.pma-dashboard del .woocommerce-Price-currencySymbol {
  font-size: .78em;
  opacity: .6;
}

.pma-scope .woocommerce-Price-taxLabel,
.pma-dashboard .woocommerce-Price-taxLabel {
  margin-inline-start: .3em;
  font-size: .66em;
  font-weight: 500;
  opacity: .6;
}

/* ── Toasts + notice popup (pma-notices.js) ──────────────────────────────
   Shared by every surface (account, cart, checkout), so they live here in
   the always-loaded layer. Same soft-corner language as the rest.
   ──────────────────────────────────────────────────────────────────────── */
.pma-toast-stack {
  position: fixed;
  top: calc(16px + var(--wp-admin--admin-bar--height, 0px));
  left: 50%;
  z-index: 1000001;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
  font-family: var(--pma-font, inherit);
}

.pma-toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  color: #1a1520;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.8;
  text-align: start;
  background: rgba(255,255,255, .96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid #ebe6ef;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(26,21,32, .05), 0 18px 40px -18px rgba(26,21,32, .35);
  opacity: 0;
  transform: translateY(-10px) scale(.98);
  transition: opacity .3s cubic-bezier(.2, .8, .2, 1), transform .35s cubic-bezier(.2, .8, .2, 1);
  pointer-events: auto;
}

.pma-toast-item.is-in { opacity: 1; transform: none; }
.pma-toast-item.is-out { opacity: 0; transform: translateY(-8px) scale(.98); }

.pma-toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 5px;
}

.pma-toast-icon svg { width: 16px; height: 16px; }
.pma-toast-item.is-success .pma-toast-icon { color: #7c1695; background: #e9f7ee; }
.pma-toast-item.is-error .pma-toast-icon   { color: #8f6d43; background: #fdecee; }
.pma-toast-item.is-info .pma-toast-icon    { color: var(--pma-brand, #7c1695); background: var(--pma-brand-dim, #f4e9f7); }

.pma-toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.pma-toast-body a { color: var(--pma-brand, #7c1695); font-weight: 700; }

.pma-toast-close {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: #8f8896;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.pma-toast-close:hover { color: #1a1520; background: #f6f4f8; }

.pma-modal.is-in .pma-modal-backdrop { opacity: 1; }

.pma-modal .pma-modal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px 24px 22px;
  text-align: center;
  background: #fff;
  border: 1px solid #ebe6ef;
  border-radius: 5px !important;
  box-shadow: 0 30px 70px -24px rgba(20,14,24, .45);
  transform: translateY(14px) scale(.98);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

.pma-modal.is-in .pma-modal-card { transform: none; }

.pma-modal .pma-modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #8f8896;
  background: transparent;
  border: 0;
  border-radius: 5px !important;
  cursor: pointer;
}

.pma-modal .pma-modal-close:hover { color: #1a1520; background: #f6f4f8; }
.pma-modal .pma-modal-close svg { width: 16px; height: 16px; }

.pma-modal .pma-modal-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 5px !important;
}

.pma-modal .pma-modal-icon svg { width: 26px; height: 26px; }
.pma-modal.is-error .pma-modal-icon   { color: #8f6d43; background: #fdecee; }
.pma-modal.is-success .pma-modal-icon { color: #7c1695; background: #e9f7ee; }
.pma-modal.is-info .pma-modal-icon    { color: var(--pma-brand, #7c1695); background: var(--pma-brand-dim, #f4e9f7); }

.pma-modal .pma-modal-title { margin: 0 0 8px; font-size: 16px; font-weight: 800; line-height: 1.6; color: #1a1520; }
.pma-modal .pma-modal-body { margin: 0 0 18px; font-size: 13.5px; line-height: 1.9; color: #5c5563; }

.pma-modal .pma-modal-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: start;
}

.pma-modal .pma-modal-list li {
  position: relative;
  padding: 8px 12px;
  padding-inline-start: 28px;
  font-size: 13px;
  background: #fdf5f6;
  border: 1px solid #f6efe5;
  border-radius: 5px;
}

.pma-modal .pma-modal-list li::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 12px;
  width: 6px;
  height: 6px;
  background: #8f6d43;
  border-radius: 50%;
  transform: translateY(-50%);
}

.pma-modal .pma-modal-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--pma-on-brand, #fff);
  background: var(--pma-brand, #7c1695);
  border: 0;
  border-radius: 5px !important;
  cursor: pointer;
}

@media (max-width: 520px) {
  .pma-toast-stack { top: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
