/* =============================
   Readeezy Dashboard — Modern Stylesheet (v2)
   Goals: clean, accessible, intuitive. Minimal markup changes required.
   Drop-in replacement for your existing stylesheet.
   ============================= */

/* ---------- CSS Variables (Theme) ---------- */
:root {
  /* --bg:        #f6f8fb; /* 
  --surface:   #ffffff;
  --ink:       #2f3541;        /* primary text */
  --ink-muted: #6b7380;        /* secondary text */
  --border:    #e6eaf0;
  --ring:      #3b82f6;        /* focus ring */
  --primary:   #3b82f6;        /* blue-500 */
  --primary-600:#2563eb;       /* blue-600 */
  --primary-700:#1d4ed8;       /* blue-700 */
  --success:   #10b981;        /* emerald */
  --warning:   #f59e0b;        /* amber */
  --danger:    #ef4444;        /* red */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, 0.08);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

/* ---------- Resets & Base ---------- */
html, body { height: 100%; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: "Inter", "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  /* background: linear-gradient(180deg, #f7f9fc 0%, #eef2f9 100%); */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

img { max-width: 100%; height: auto; }

p { color: var(--ink-muted); line-height: 1.6; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }

/* ---------- Layout Helpers ---------- */
.container {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.card-body { padding: 20px 24px; }

.page-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.375rem;
}

.subtle { color: var(--ink-muted); }

/* ---------- Buttons ---------- */
.button, .btn, button[type="submit"], input[type="submit"], .wp-core-ui .button.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: transform .02s ease-in, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, .25);
}

.btn:hover, .button:hover, button[type="submit"]:hover, input[type="submit"]:hover {
  background: var(--primary-600);
}

.btn:active, .button:active, button[type="submit"]:active, input[type="submit"]:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { border-color: #d8dee8; }

.btn-ghost {
  background: transparent; border-color: transparent; color: var(--primary);
}

.btn[disabled], .button[disabled], button[disabled], input[type="submit"][disabled] {
  opacity: .6; cursor: not-allowed; box-shadow: none;
}

/* Loading state utility for your existing ButtonSaveClicked() swap */
.btn-loading::after {
  content: "";
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.6);
  border-top-color: #fff; display: inline-block; animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label { font-weight: 600; color: var(--ink); }

input, textarea, select {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

textarea { min-height: 120px; resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .15);
}

input[readonly], input[disabled], select[disabled], textarea[disabled] { background: #f3f6fb; color: #9aa3b2; }

/* Inline small controls you already use (e.g., .hipaa) */
input.hipaa {
  width: auto; height: 20px; padding: 0; border-radius: 4px;
}

.help, .hint { color: var(--ink-muted); font-size: .9375rem; margin-top: 6px; }

/* Validation states (optional to toggle via classes) */
.is-error { border-color: var(--danger); }
.is-error:focus { box-shadow: 0 0 0 4px rgba(239, 68, 68, .15); }

.is-success { border-color: var(--success); }
.is-success:focus { box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }

/* Grouping */
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; background: #fff; }
.legend  { font-size: .8rem; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); }

/* Grid form layout that works even if your current markup uses a table */
.form-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px 18px;
  align-items: center;
}

.form-row { display: contents; }
.form-grid .label { font-weight: 600; color: var(--ink); }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Table forms (compatible with existing table-based form) ---------- */
/* If your PHP form uses a <table>, this styles it nicely without HTML changes. */
.table-form { width: 100%; border-collapse: separate; border-spacing: 0 12px; }
.table-form td { border: none; padding: 10; vertical-align: middle; }
.table-form td.left { width: 220px; padding-right: 16px; color: var(--ink); font-weight: 600; }
.table-form td input,
.table-form td select,
.table-form td textarea { width: 100%; }

/* ---------- Tables (data) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table thead th { text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; color: var(--ink-muted); }
.table tbody tr:hover { background: #fafcff; }

/* ---------- Alerts ---------- */
.alert {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.alert-success { border-color: rgba(16,185,129,.25); background: rgba(16,185,129,.08); }
.alert-warning { border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.10); }
.alert-danger  { border-color: rgba(239,68,68,.25);  background: rgba(239,68,68,.10); }

.alert .title { font-weight: 700; color: var(--ink); }
.alert .msg { color: var(--ink-muted); }

/* ---------- Badges / Pills ---------- */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-weight: 600; font-size: .75rem; letter-spacing: .02em;
  background: #eef2ff; color: #3730a3; border: 1px solid #e0e7ff;
}

/* ---------- Breadcrumbs / Header actions ---------- */
.header-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin: 24px 0;
}

.actions { display: flex; gap: 10px; }

/* ---------- Utility spacing ---------- */
.mt-0{margin-top:0}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-20{margin-top:20px}.mt-24{margin-top:24px}
.mb-0{margin-bottom:0}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}

/* ---------- Visually hidden (for accessibility) ---------- */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Header & Nav (optional) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(120%) blur(6px);
  background: rgba(255,255,255,.75);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.topbar .brand { font-weight: 800; letter-spacing: .02em; }

/* ---------- Footer (optional) ---------- */
.footer { color: var(--ink-muted); padding: 16px 0; font-size: .9375rem; }
