/* Membership components shared by payment.php, dashboard.php, index.php, profile.php
   and my-payments.php (markup: includes/membership_ui.php). Loaded after style.css. */

:root {
  --msp-silver: #5b6472;      /* text-safe silver/grey (6.0:1 on white) */
  --msp-silver-line: #cfd4db;
  --msp-silver-soft: #f4f5f7;
  --msp-gold: #7a5f0f;        /* = --gold-text (6:1 on white) */
  --msp-gold-line: #d4af37;
  --msp-gold-soft: #fdf6e1;
  --msp-diamond: #34506b;     /* platinum slate (8:1 on white) */
  --msp-diamond-line: #b4c4d4;
  --msp-diamond-soft: #f1f5f9;
}

/* ── Plan cards ───────────────────────────────────────────── */
.msp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
  max-width: 1140px;
  margin: 0 auto;
  padding-top: 16px;            /* room for the ribbons */
}
.msp-grid.is-compact { gap: 18px; }

.msp-card {
  --tier: var(--msp-silver);
  --tier-line: var(--msp-silver-line);
  --tier-soft: var(--msp-silver-soft);
  --tier-grad: linear-gradient(135deg, #f5f7f9 0%, #c3c9d1 30%, #eef1f4 52%, #a9b1bc 78%, #e3e7ec 100%);
  --tier-band: linear-gradient(180deg, #f1f3f6 0%, #fbfcfd 70%, #fff 100%);
  --tier-medal-ink: #36404c;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 24px;
  background: linear-gradient(#fff, #fff) padding-box, var(--tier-grad) border-box;
  box-shadow: 0 1px 2px rgba(43, 33, 24, .04), 0 10px 28px -8px rgba(43, 33, 24, .10), 0 28px 56px -28px rgba(43, 33, 24, .16);
  transition: transform .3s ease, box-shadow .3s ease;
}
.msp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(43, 33, 24, .05), 0 16px 36px -10px rgba(43, 33, 24, .16), 0 36px 64px -30px rgba(43, 33, 24, .22);
}
.msp-card--gold {
  --tier: var(--msp-gold);
  --tier-line: var(--msp-gold-line);
  --tier-soft: var(--msp-gold-soft);
  --tier-grad: linear-gradient(135deg, #f8e7a8 0%, #d4af37 32%, #f3d77a 55%, #b8941f 80%, #ecd389 100%);
  --tier-band: linear-gradient(180deg, #faf0d4 0%, #fdf9ee 70%, #fff 100%);
  --tier-medal-ink: #5c0000;
}
.msp-card--diamond {
  --tier: var(--msp-diamond);
  --tier-line: var(--msp-diamond-line);
  --tier-soft: var(--msp-diamond-soft);
  --tier-grad: linear-gradient(135deg, #f2f8fc 0%, #b7cde0 30%, #f9fcfe 52%, #8fa9c1 78%, #dce8f2 100%);
  --tier-band: linear-gradient(180deg, #e6eff6 0%, #f6f9fc 70%, #fff 100%);
  --tier-medal-ink: #1f3346;
}
.msp-card.is-featured {
  box-shadow: 0 1px 2px rgba(43, 33, 24, .04), 0 14px 34px -10px rgba(184, 148, 31, .38), 0 30px 64px -26px rgba(212, 175, 55, .45);
}
.msp-card.is-featured:hover {
  box-shadow: 0 2px 4px rgba(43, 33, 24, .05), 0 18px 42px -10px rgba(184, 148, 31, .45), 0 38px 72px -26px rgba(212, 175, 55, .55);
}
.msp-card.is-selected { outline: 3px solid var(--maroon); outline-offset: 4px; }
.msp-card.is-current {
  --tier-grad: linear-gradient(135deg, #bbf7d0, #22c55e 50%, #bbf7d0);
}

/* Ribbon */
.msp-ribbon {
  position: absolute; z-index: 2;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  color: var(--tier);
  border: 1px solid var(--tier-line);
  font-size: .7rem; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  padding: 5px 16px; border-radius: 50px;
  box-shadow: 0 6px 16px -6px rgba(43, 33, 24, .25);
}
.msp-card--gold .msp-ribbon { background: var(--gold-gradient); color: var(--maroon-dark); border-color: #c9a43a; }
.msp-ribbon--current { background: #ecfdf3 !important; color: #166534 !important; border-color: #86efac !important; }

/* Header band */
.msp-band {
  position: relative;
  overflow: hidden;
  border-radius: 22px 22px 0 0;
  padding: 30px 24px 18px;
  text-align: center;
  background: var(--tier-band);
}
.msp-card--diamond .msp-band::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .8) 50%, transparent 65%);
  background-size: 260% 100%;
  animation: msp-sheen 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes msp-sheen { 0%, 55% { background-position: 130% 0; } 100% { background-position: -130% 0; } }
.msp-medal {
  position: relative; z-index: 1;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 12px;
  background: var(--tier-grad);
  color: var(--tier-medal-ink);
  font-size: 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -2px 6px rgba(0, 0, 0, .08), 0 8px 18px -8px rgba(43, 33, 24, .35);
}
.msp-name {
  position: relative; z-index: 1;
  font-family: var(--font-head); font-size: 1.65rem; font-weight: 700;
  color: var(--ink); margin: 0 0 8px; line-height: 1.15;
}
.msp-level {
  position: relative; z-index: 1;
  display: inline-block;
  font-size: .68rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--tier);
  background: #fff;
  border: 1px solid var(--tier-line);
  border-radius: 50px;
  padding: 4px 12px;
}

/* Body */
.msp-body { display: flex; flex-direction: column; flex: 1; padding: 6px 28px 28px; }
.msp-tagline { text-align: center; font-size: .9rem; color: #5e5449; margin: 4px 0 18px; line-height: 1.55; }

.msp-price { text-align: center; color: var(--ink); }
.msp-price-vis { display: inline-flex; align-items: flex-start; font-variant-numeric: lining-nums tabular-nums; }
.msp-sym { position: static; font-size: 1.2rem; font-weight: 700; color: var(--tier); margin: 9px 2px 0 0; line-height: 1; }
.msp-amt {
  font-family: var(--font-head); font-size: 3.1rem; font-weight: 700;
  line-height: 1; letter-spacing: -1px;
  font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1;
}
.msp-per { align-self: flex-end; margin: 0 0 7px 6px; font-size: .88rem; color: var(--muted); }
.msp-inr { text-align: center; font-size: .78rem; color: var(--muted); margin: 6px 0 0; font-variant-numeric: lining-nums; }

/* Hero stat: contact access */
.msp-stat {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 20px 0;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--tier-soft);
  border: 1px solid color-mix(in srgb, var(--tier-line) 55%, transparent);
}
.msp-stat-num {
  font-family: var(--font-head); font-size: 2.7rem; font-weight: 700; line-height: 1;
  color: var(--tier);
  font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1;
  min-width: .8em; text-align: center;
}
.msp-stat-lbl {
  font-size: .76rem; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase;
  color: #3d3127; line-height: 1.35; max-width: 10.5em; text-align: left;
}

/* Features */
.msp-feats { list-style: none; margin: 0; padding: 0; }
.msp-feats li { display: flex; align-items: flex-start; gap: 11px; padding: 6px 0; font-size: .9rem; line-height: 1.45; color: #3d3127; }
.msp-feats i {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tier-soft);
  color: var(--tier);
  font-size: .62rem;
}
.msp-more { margin-top: 4px; }
.msp-more summary {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; list-style: none;
  font-size: .85rem; font-weight: 700; color: var(--maroon);
  padding: 6px 2px; border-radius: 6px;
}
.msp-more summary::-webkit-details-marker { display: none; }
.msp-more summary::after {
  content: ''; width: 7px; height: 7px; margin-left: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s ease;
}
.msp-more[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.msp-more summary:hover { color: var(--maroon-dark); text-decoration: underline; }
.msp-more summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.msp-more-n { font-weight: 600; color: var(--muted); }

/* CTA */
.msp-cta { margin-top: auto; padding-top: 22px; }
.msp-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid #5b6472;
  background: #fff;
  color: #2d3540;
  font-weight: 700; font-size: .95rem; letter-spacing: .2px; text-decoration: none;
  transition: background .2s ease, box-shadow .2s ease, color .2s ease, filter .2s ease;
}
.msp-btn:hover { background: #f1f3f6; color: #1f262e; }
.msp-btn:focus-visible, .mui-btn:focus-visible, .msu-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.msp-card--gold .msp-btn:not(.is-disabled) {
  background: var(--gold-gradient); border-color: #c9a43a; color: var(--maroon-dark);
  box-shadow: 0 8px 22px -8px rgba(184, 148, 31, .6);
}
.msp-card--gold .msp-btn:not(.is-disabled):hover { filter: brightness(1.04); box-shadow: 0 12px 28px -8px rgba(184, 148, 31, .7); }
.msp-card--diamond .msp-btn:not(.is-disabled) {
  background: linear-gradient(135deg, #34465a 0%, #1d2935 100%); border-color: #1d2935; color: #eef3f8;
  box-shadow: 0 8px 22px -10px rgba(29, 41, 53, .6);
}
.msp-card--diamond .msp-btn:not(.is-disabled):hover { background: linear-gradient(135deg, #3d526a 0%, #233140 100%); color: #fff; }
.msp-btn.is-disabled { background: #f4f2ef; border-color: #e2ddd6; color: #5e5449; cursor: default; box-shadow: none; }
.msp-btn.is-current-btn { background: #ecfdf3; border-color: #86efac; color: #166534; }
.msp-note { font-size: .8rem; color: #5e5449; margin: 10px 0 0; line-height: 1.45; text-align: center; }
.msp-policy { font-size: .78rem; color: var(--muted); margin: 14px 0 0; line-height: 1.5; text-align: center; }

/* Compact (dashboard) */
.msp-card.is-compact { border-radius: 20px; }
.is-compact .msp-band { border-radius: 18px 18px 0 0; padding: 24px 16px 12px; }
.is-compact .msp-medal { width: 46px; height: 46px; font-size: 1.05rem; margin-bottom: 8px; }
.is-compact .msp-name { font-size: 1.3rem; }
.is-compact .msp-body { padding: 4px 18px 20px; }
.is-compact .msp-amt { font-size: 2.3rem; }
.is-compact .msp-stat { margin: 14px 0 0; padding: 10px 12px; }
.is-compact .msp-stat-num { font-size: 2rem; }
.is-compact .msp-cta { padding-top: 16px; }

/* Trust row */
.msp-trust {
  list-style: none; margin: 30px auto 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px;
  font-size: .84rem; color: #4a3f35;
}
.msp-trust li { display: inline-flex; align-items: center; gap: 7px; }
.msp-trust i { color: var(--gold-dark); }
.msp-trust a { color: var(--maroon); font-weight: 700; }

/* Entrance */
@keyframes msp-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.js .msp-grid .msp-card { animation: msp-in .6s cubic-bezier(.22, 1, .36, 1) backwards; }
.js .msp-grid .msp-card:nth-child(2) { animation-delay: .08s; }
.js .msp-grid .msp-card:nth-child(3) { animation-delay: .16s; }

@media (max-width: 991.98px) {
  .msp-grid { grid-template-columns: minmax(0, 1fr); max-width: 540px; gap: 30px; }
  .msp-card.is-featured { order: -1; }
  .msp-card:hover, .msp-card.is-featured:hover { transform: none; }
}
@media (max-width: 575.98px) {
  .msp-body { padding: 4px 18px 22px; }
  .msp-band { padding: 28px 16px 14px; }
  .msp-amt { font-size: 2.6rem; }
}

/* ── Comparison table ─────────────────────────────────────── */
.mui-compare-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--beige);
  border-radius: 20px;
  box-shadow: 0 10px 28px -12px rgba(43, 33, 24, .14);
  max-width: 1140px; margin: 0 auto;
}
.mui-compare-wrap:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mui-compare { width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.mui-compare th, .mui-compare td { padding: 13px 16px; border-bottom: 1px solid #f1eadc; text-align: center; vertical-align: middle; }
.mui-compare tbody tr:last-child th, .mui-compare tbody tr:last-child td { border-bottom: 0; }
.mui-compare tbody tr:nth-child(even) td, .mui-compare tbody tr:nth-child(even) th { background: #fdfbf7; }
.mui-compare thead th { font-weight: 700; color: var(--ink); background: #fff; border-bottom: 3px solid var(--beige); padding-top: 16px; padding-bottom: 14px; }
.mui-compare thead .mui-col--silver  { background: #f3f5f8; border-bottom-color: #b8bfc8; }
.mui-compare thead .mui-col--gold    { background: #fbf3dc; border-bottom-color: var(--gold); }
.mui-compare thead .mui-col--diamond { background: #eaf2f8; border-bottom-color: #9fb6cb; }
.mui-compare th[scope="row"], .mui-compare thead th:first-child {
  position: sticky; left: 0; z-index: 1;
  background: #fff;
  text-align: left; font-weight: 600; color: #3d3127;
  min-width: 190px;
  box-shadow: 6px 0 10px -8px rgba(43, 33, 24, .18);
}
.mui-th-name { display: block; font-family: var(--font-head); font-size: 1.05rem; }
.mui-th-level { display: block; margin-top: 2px; font-size: .68rem; letter-spacing: 1.2px; text-transform: uppercase; color: #5e5449; font-weight: 700; }
.mui-col--silver .mui-th-name i  { color: var(--msp-silver); }
.mui-col--gold .mui-th-name i    { color: var(--gold-dark); }
.mui-col--diamond .mui-th-name i { color: var(--msp-diamond); }
.mui-compare td strong { font-variant-numeric: lining-nums tabular-nums; }
.mui-yes { color: #15803d; font-size: 1rem; }
.mui-no  { color: #9a8f83; font-size: .95rem; }

/* ── My Membership panel ──────────────────────────────────── */
.mui-panel {
  --tier: var(--maroon);
  --tier-line: var(--beige);
  background: #fff;
  border: 1px solid var(--beige);
  border-left: 4px solid var(--tier-line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 4px 18px rgba(43, 33, 24, .05);
}
.mui-panel--silver  { --tier: var(--msp-silver);  --tier-line: var(--msp-silver-line); }
.mui-panel--gold    { --tier: var(--msp-gold);    --tier-line: var(--msp-gold-line); }
.mui-panel--diamond { --tier: var(--msp-diamond); --tier-line: var(--msp-diamond-line); }
.mui-panel-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mui-panel-title { font-family: var(--font-head); font-size: 1.08rem; color: var(--maroon); margin: 0; display: flex; align-items: center; gap: 8px; }
.mui-panel-title i { color: var(--gold-dark); }
.mui-status { font-size: .72rem; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 4px 10px; border-radius: 50px; border: 1px solid; }
.mui-status--active    { background: #ecfdf3; color: #166534; border-color: #86efac; }
.mui-status--expired   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.mui-status--refunded, .mui-status--cancelled { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
.mui-status--none      { background: #f5f5f4; color: #57534e; border-color: #e7e5e4; }
.mui-panel-plan { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.mui-panel-name { font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.mui-panel-level { font-size: .74rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--tier); }
.mui-panel-price { font-size: .88rem; color: var(--muted); }
.mui-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.mui-stats > div { background: var(--cream); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.mui-stats dt { font-size: .7rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.mui-stats dd { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 767.98px) { .mui-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mui-meter { height: 8px; background: #f0e8d8; border-radius: 50px; overflow: hidden; margin-bottom: 10px; }
.mui-meter span { display: block; height: 100%; background: var(--gold-gradient); border-radius: 50px; }
.mui-panel-sub { font-size: .88rem; color: #4a3f35; margin: 0 0 12px; line-height: 1.55; }
.mui-alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 10px 14px; font-size: .86rem; line-height: 1.5; margin-bottom: 12px; }
.mui-alert--warn { background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; }
.mui-alert--info { background: var(--cream); border: 1px solid var(--beige); color: #4a3f35; }
.mui-alert i { margin-top: 3px; }
.mui-panel-cta { display: flex; flex-wrap: wrap; gap: 8px; }
.mui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px; border-radius: 10px;
  background: var(--maroon); color: #fff; border: 1.5px solid var(--maroon);
  font-weight: 700; font-size: .88rem; text-decoration: none;
}
.mui-btn:hover { background: var(--maroon-dark); color: #fff; }
.mui-btn--ghost { background: #fff; color: var(--maroon); }
.mui-btn--ghost:hover { background: var(--cream); color: var(--maroon-dark); }
.mui-btn-sub { font-weight: 500; opacity: .9; font-size: .8rem; }
.mui-panel.is-compact .mui-stats { margin-bottom: 10px; }

/* ── Contacts unlocked list (dashboard) ───────────────────── */
.mui-unlocked { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mui-unlocked li {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--beige); border-radius: 12px; padding: 10px 12px;
}
.mui-unlocked img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--cream); }
.mui-unlocked-main { flex: 1; min-width: 0; }
.mui-unlocked-name { font-weight: 700; color: var(--maroon); text-decoration: none; overflow-wrap: anywhere; }
.mui-unlocked-name:hover { text-decoration: underline; }
.mui-unlocked-meta { font-size: .78rem; color: var(--muted); }
.mui-unlocked-date { font-size: .78rem; color: #4a3f35; white-space: nowrap; }
@media (max-width: 479.98px) {
  .mui-unlocked li { flex-wrap: wrap; }
  .mui-unlocked-date { width: 100%; padding-left: 58px; }
}

/* ── Profile contact unlock card (profile.php) ────────────── */
.msu-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  background: #ecfdf3; color: #166534; border: 1px solid #86efac;
  border-radius: 50px; padding: 3px 10px; margin-left: 8px; vertical-align: middle;
}
.msu-help { font-size: .84rem; color: #4a3f35; margin: 12px 0 10px; line-height: 1.5; text-align: center; }
.msu-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 44px; padding: 9px 16px;
  border-radius: 10px; border: 1.5px solid var(--gold-dark);
  background: var(--gold-gradient); color: var(--maroon-dark);
  font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer;
}
.msu-btn:hover { box-shadow: var(--shadow-gold); color: var(--maroon-dark); }
.msu-btn[disabled] { opacity: .7; cursor: progress; }
.msu-btn--ghost { background: #fff; border-color: #d8cdbd; color: #4a3f35; }
.msu-btn--ghost:hover { box-shadow: none; background: var(--cream); color: var(--ink); }
.msu-confirm {
  margin-top: 10px;
  background: var(--cream);
  border: 1px solid var(--beige);
  border-radius: 12px;
  padding: 12px 14px;
}
.msu-confirm p { font-size: .84rem; color: #3d3127; margin: 0 0 10px; line-height: 1.5; }
.msu-confirm-actions { display: flex; gap: 8px; }
.msu-confirm-actions .msu-btn { flex: 1; }
.msu-status { font-size: .84rem; margin-top: 10px; line-height: 1.5; text-align: center; }
.msu-status:empty { display: none; }
.msu-status.is-error { color: #991b1b; }
.msu-status.is-ok { color: #166534; }

@media (prefers-reduced-motion: reduce) {
  .msp-card, .msp-btn, .mui-btn, .msu-btn, .msp-more summary::after { transition: none !important; }
  .msp-card:hover { transform: none !important; }
  .js .msp-grid .msp-card, .msp-card--diamond .msp-band::after { animation: none !important; }
}
