/* ============================================================================
   MP COMPONENTS — shared UI primitives built on mp-tokens.css
   ============================================================================

   Purpose: give the theme ONE card, ONE button and ONE badge instead of the
   five near-identical systems that existed before (.relm-btn, .mpc-btn,
   .mp-fh-btn, .mpsl-btn-save, .mppw-*), and to replace the Tailwind utility
   classes the relm shortcodes depended on — Tailwind was only ever loaded on
   page-dashboard.php, so those cards rendered unstyled everywhere else.

   Namespaced .mp-* throughout so nothing here can collide with WordPress core,
   a plugin, or the existing style.css.
   ========================================================================= */

/* ── Layout ──────────────────────────────────────────────────────────────── */
.mp-grid {
  display: grid;
  gap: var(--mp-4);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.mp-grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.mp-grid-wide { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }

.mp-stack   { display: flex; flex-direction: column; gap: var(--mp-2); }
.mp-row     { display: flex; align-items: center; gap: var(--mp-2); flex-wrap: wrap; }
.mp-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--mp-3); flex-wrap: wrap; }
.mp-spacer  { flex: 1 1 auto; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.mp-card {
  background: var(--mp-surface);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-lg);
  padding: var(--mp-4);
  box-shadow: var(--mp-shadow-sm);
  transition: box-shadow var(--mp-fast) var(--mp-ease),
              transform var(--mp-fast) var(--mp-ease),
              border-color var(--mp-fast) var(--mp-ease);
}
/* Hover lift only on devices with a real pointer — on touch this just causes
   a sticky stuck-hover state after tapping. */
@media (hover: hover) {
  .mp-card-hover:hover {
    box-shadow: var(--mp-shadow-lg);
    transform: translateY(-2px);
    border-color: var(--accent-200, #CBD5E1);
  }
}
.mp-card-flush  { padding: 0; overflow: hidden; }
.mp-card-soft   { background: var(--mp-surface-soft); }

.mp-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--mp-2); margin-bottom: var(--mp-2);
}
.mp-card-title {
  font-size: var(--mp-text-md);
  font-weight: var(--mp-weight-bold);
  color: var(--mp-ink);
  line-height: 1.3;
  margin: 0;
}
.mp-card-meta { font-size: var(--mp-text-sm); color: var(--mp-ink-soft); }
.mp-card-body > p { margin: 0 0 var(--mp-1); font-size: var(--mp-text-sm); color: var(--mp-ink-soft); }
.mp-card-foot {
  margin-top: var(--mp-3); padding-top: var(--mp-3);
  border-top: 1px solid var(--mp-line-soft);
  display: flex; align-items: center; gap: var(--mp-2); flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────────────────
   min-height is the 44px tap target from the tokens file — the old relm
   buttons were ~30px, which is below every mobile guideline.              */
.mp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--mp-1);
  min-height: var(--mp-tap);
  padding: var(--mp-2) var(--mp-4);
  border: 1.5px solid transparent;
  border-radius: var(--mp-r-sm);
  font-family: inherit;
  font-size: var(--mp-text-sm);
  font-weight: var(--mp-weight-bold);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--mp-fast) var(--mp-ease),
              border-color var(--mp-fast) var(--mp-ease),
              color var(--mp-fast) var(--mp-ease);
}
.mp-btn:disabled, .mp-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* Visible keyboard focus — the old inline-styled buttons had none at all. */
.mp-btn:focus-visible,
.mp-field:focus-visible,
.mp-input:focus-visible,
.mp-select:focus-visible {
  outline: 2px solid var(--accent, #2563EB);
  outline-offset: 2px;
}

.mp-btn-primary   { background: var(--accent, #1D3A5F); color: var(--text-on-accent, #fff); }
.mp-btn-primary:hover   { background: var(--accent-dark, #16304F); color: var(--text-on-accent, #fff); }

.mp-btn-outline   { background: var(--mp-surface); color: var(--accent, #1D3A5F); border-color: var(--mp-line); }
.mp-btn-outline:hover   { background: var(--mp-surface-soft); border-color: var(--accent, #1D3A5F); }

.mp-btn-ghost     { background: transparent; color: var(--mp-ink-soft); }
.mp-btn-ghost:hover     { background: var(--mp-surface-soft); color: var(--mp-ink); }

.mp-btn-wa        { background: var(--mp-whatsapp); color: #fff; }
.mp-btn-wa:hover        { background: #1EBE5D; color: #fff; }

.mp-btn-success   { background: var(--mp-success); color: #fff; }
.mp-btn-danger    { background: var(--mp-danger);  color: #fff; }

.mp-btn-sm { min-height: 34px; padding: var(--mp-1) var(--mp-3); font-size: var(--mp-text-xs); }
.mp-btn-lg { min-height: 50px; padding: var(--mp-3) var(--mp-6); font-size: var(--mp-text-md); }
.mp-btn-block { width: 100%; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.mp-badge {
  display: inline-flex; align-items: center; gap: var(--mp-1);
  padding: 2px var(--mp-2);
  border-radius: var(--mp-r-pill);
  font-size: var(--mp-text-xs);
  font-weight: var(--mp-weight-black);
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1.6;
}
.mp-badge-neutral { background: var(--mp-line-soft); color: var(--mp-ink-soft); }
.mp-badge-success { background: var(--mp-success-soft); color: var(--mp-success); border: 1px solid var(--mp-success-line); }
.mp-badge-warn    { background: var(--mp-warn-soft);    color: var(--mp-warn);    border: 1px solid var(--mp-warn-line); }
.mp-badge-danger  { background: var(--mp-danger-soft);  color: var(--mp-danger);  border: 1px solid var(--mp-danger-line); }
.mp-badge-info    { background: var(--mp-info-soft);    color: var(--mp-info);    border: 1px solid var(--mp-info-line); }
.mp-badge-solid   { background: var(--accent, #1D3A5F); color: var(--text-on-accent, #fff); }

/* ── Forms ───────────────────────────────────────────────────────────────
   font-size is 16px on mobile deliberately: anything smaller makes iOS Safari
   zoom the viewport on focus, which felt like a bug on the old filter bars. */
.mp-field { display: flex; flex-direction: column; gap: var(--mp-1); min-width: 0; }
.mp-label {
  font-size: var(--mp-text-xs);
  font-weight: var(--mp-weight-bold);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mp-ink-muted);
}
.mp-input, .mp-select, .mp-textarea {
  width: 100%;
  min-height: var(--mp-tap);
  padding: var(--mp-2) var(--mp-3);
  border: 1.5px solid var(--mp-line);
  border-radius: var(--mp-r-sm);
  background: var(--mp-surface);
  color: var(--mp-ink);
  font-family: inherit;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color var(--mp-fast) var(--mp-ease), box-shadow var(--mp-fast) var(--mp-ease);
}
@media (min-width: 782px) {
  .mp-input, .mp-select, .mp-textarea { font-size: var(--mp-text-md); }
}
.mp-input:focus, .mp-select:focus, .mp-textarea:focus {
  outline: none;
  border-color: var(--accent, #2563EB);
  box-shadow: 0 0 0 3px var(--accent-100, rgba(37,99,235,.12));
}
.mp-textarea { min-height: 90px; resize: vertical; }

.mp-filterbar {
  display: flex; gap: var(--mp-2); flex-wrap: wrap; align-items: flex-end;
  padding: var(--mp-3);
  background: var(--mp-surface-soft);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r);
  margin-bottom: var(--mp-4);
}
.mp-filterbar .mp-field { flex: 1 1 170px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.mp-pagination { display: flex; gap: var(--mp-1); flex-wrap: wrap; justify-content: center; margin-top: var(--mp-6); }
.mp-page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; min-height: 38px; padding: 0 var(--mp-2);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-sm);
  background: var(--mp-surface);
  color: var(--mp-ink-soft);
  font-size: var(--mp-text-sm);
  font-weight: var(--mp-weight-bold);
  text-decoration: none;
}
.mp-page-link:hover { background: var(--mp-surface-soft); color: var(--mp-ink); }
.mp-page-link[aria-current="page"] {
  background: var(--accent, #1D3A5F);
  border-color: var(--accent, #1D3A5F);
  color: var(--text-on-accent, #fff);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.mp-empty {
  text-align: center;
  padding: var(--mp-10) var(--mp-4);
  color: var(--mp-ink-muted);
  background: var(--mp-surface-soft);
  border: 1px dashed var(--mp-line);
  border-radius: var(--mp-r);
}
.mp-empty-title { display: block; font-size: var(--mp-text-md); font-weight: var(--mp-weight-bold); color: var(--mp-ink-soft); margin-bottom: var(--mp-1); }

/* ── Masked / gated values ───────────────────────────────────────────────── */
.mp-masked { color: var(--mp-ink-muted); font-style: italic; }
.mp-lock-link { color: var(--accent, #2563EB); font-weight: var(--mp-weight-bold); text-decoration: none; }
.mp-lock-link:hover { text-decoration: underline; }

/* ── Screen-reader-only utility ──────────────────────────────────────────── */
.mp-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
