/* ============================================================
   GrL'Ca MailGuard — Admin Styles
   Design: Dark industrial with electric-teal accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables + wrap — self-contained dark island ───────── */
.mg-wrap {
  --mg-bg:          #0f1117;
  --mg-surface:     #161b27;
  --mg-surface2:    #1e2535;
  --mg-border:      #2a3146;
  --mg-accent:      #00d4aa;
  --mg-accent-dim:  rgba(0,212,170,.12);
  --mg-danger:      #ff4d6a;
  --mg-danger-dim:  rgba(255,77,106,.12);
  --mg-warn:        #f5a623;
  --mg-warn-dim:    rgba(245,166,35,.12);
  --mg-text:        #e2e8f4;
  --mg-muted:       #7a86a0;
  --mg-radius:      10px;
  --mg-radius-sm:   6px;
  --mg-shadow:      0 4px 24px rgba(0,0,0,.35);
  --mg-font:        'DM Sans', sans-serif;
  --mg-mono:        'DM Mono', monospace;

  background: #0f1117 !important;
  font-family: 'DM Sans', sans-serif;
  color: #e2e8f4 !important;
  max-width: 1200px;
  padding: 20px 24px 40px;
  border-radius: 12px;
  margin-top: 12px;
}
.mg-wrap * { box-sizing: border-box; color: inherit; }

/* Force all text inside mg-wrap to be visible — override WP admin resets */
.mg-wrap p,
.mg-wrap td,
.mg-wrap th,
.mg-wrap label,
.mg-wrap span,
.mg-wrap h1,
.mg-wrap h2,
.mg-wrap h3,
.mg-wrap li {
  color: #e2e8f4;
}
.mg-wrap a { color: #00d4aa; }

/* ── Header ───────────────────────────────────────────── */
.mg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 24px;
  border-bottom: 1px solid #2a3146;
  margin-bottom: 28px;
}
.mg-header__brand { display: flex; align-items: center; gap: 14px; }
.mg-header__logo  { font-size: 28px; line-height: 1; }
.mg-header__title {
  font-size: 22px; font-weight: 600; color: #e2e8f4;
  margin: 0; padding: 0; border: 0;
}
.mg-header__sub   { font-size: 12px; color: #7a86a0; margin: 2px 0 0; }

/* ── Badges ───────────────────────────────────────────── */
.mg-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .03em;
}
.mg-badge--ok   { background: rgba(0,212,170,.12); color: #00d4aa; }
.mg-badge--warn { background: rgba(245,166,35,.12);   color: #f5a623;   }

/* ── Stat cards ───────────────────────────────────────── */
.mg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.mg-card {
  background: #161b27;
  border: 1px solid #2a3146;
  border-radius: 10px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform .15s, box-shadow .15s;
}
.mg-card:hover { transform: translateY(-2px); box-shadow: 0 4px 24px rgba(0,0,0,.35); }
.mg-card__icon { font-size: 28px; flex-shrink: 0; }
.mg-card__body { display: flex; flex-direction: column; }
.mg-card__num  { font-size: 28px; font-weight: 700; line-height: 1; }
.mg-card__label { font-size: 12px; color: #7a86a0 !important; margin-top: 4px; }

.mg-card--primary { border-left: 3px solid #00d4aa; }
.mg-card--primary .mg-card__num { color: #00d4aa; }
.mg-card--success { border-left: 3px solid #34d399; }
.mg-card--success .mg-card__num { color: #34d399; }
.mg-card--danger  { border-left: 3px solid #ff4d6a; }
.mg-card--danger  .mg-card__num { color: #ff4d6a; }
.mg-card--neutral { border-left: 3px solid #2a3146; }

/* ── Panel ────────────────────────────────────────────── */
.mg-panel {
  background: #161b27;
  border: 1px solid #2a3146;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
}
.mg-panel--form { max-width: 700px; }
.mg-panel--info {
  background: rgba(0,212,170,.06) !important;
  border-color: rgba(0,212,170,.2);
}
.mg-panel--info h3 { color: #00d4aa !important; margin: 0 0 10px; font-size: 14px; }
.mg-panel--info p  { margin: 0; font-size: 13px; color: #7a86a0 !important; line-height: 1.6; }

.mg-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid #2a3146;
}
.mg-panel__head h2 { margin: 0; font-size: 15px; font-weight: 600; }

/* ── Two-column layout ────────────────────────────────── */
.mg-two-col { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .mg-two-col { grid-template-columns: 1fr; } }
.mg-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* ── Table ────────────────────────────────────────────── */
.mg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mg-table th {
  text-align: left; padding: 10px 14px;
  color: #7a86a0 !important; font-weight: 500; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid #2a3146;
}
.mg-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(42,49,70,.6);
  vertical-align: top;
  color: #e2e8f4 !important;
}
.mg-table tbody tr:hover td { background: #1e2535; }
.mg-table--compact td,
.mg-table--compact th { padding: 8px 12px; }
.mg-table--log td:first-child { white-space: nowrap; font-family: 'DM Mono', monospace; font-size: 12px; }

/* ── Status badge ─────────────────────────────────────── */
.mg-status {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
}
.mg-status--sent   { background: rgba(52,211,153,.15); color: #34d399; }
.mg-status--failed { background: rgba(255,77,106,.12); color: #ff4d6a; }

/* ── Form elements ────────────────────────────────────── */
.mg-field { margin-bottom: 20px; }
.mg-field--grow { flex: 1; }
.mg-field--narrow { width: 100px; }
.mg-field-row { display: flex; gap: 16px; align-items: flex-end; }
.mg-field-row--tight { gap: 10px; }

.mg-label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 500; color: #e2e8f4 !important; color: #e2e8f4;
}
.mg-hint {
  margin: 6px 0 0; font-size: 12px; color: #7a86a0 !important; line-height: 1.5;
}
.mg-input {
  width: 100%; padding: 9px 13px;
  background: #0f1117; border: 1px solid #2a3146;
  border-radius: 6px; color: #e2e8f4;
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.mg-input:focus {
  outline: none;
  border-color: #00d4aa;
  box-shadow: 0 0 0 3px rgba(0,212,170,.12);
}
.mg-input--sm { width: 90px; }
.mg-input--md { max-width: 340px; }
.mg-input-wrap { position: relative; display: flex; }
.mg-input-wrap .mg-input { padding-right: 42px; }
.mg-input-addon {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  width: 38px; background: #1e2535;
  border: 0; border-radius: 0 5px 5px 0; cursor: pointer;
  color: #7a86a0; font-size: 14px; transition: color .15s;
}
.mg-input-addon:hover { color: #e2e8f4; }
.mg-input-wrap--inline { display: flex; align-items: center; gap: 8px; }
.mg-input-wrap--inline .mg-input { width: auto; }
.mg-input-suffix { color: #7a86a0; font-size: 13px; }

.mg-select {
  padding: 8px 12px;
  background: #0f1117; border: 1px solid #2a3146;
  border-radius: 6px; color: #e2e8f4;
  font-family: 'DM Sans', sans-serif; font-size: 13px; cursor: pointer;
}
.mg-select:focus { outline: none; border-color: #00d4aa; }

/* ── Toggle ───────────────────────────────────────────── */
.mg-field--toggle { display: flex; align-items: flex-start; gap: 14px; }
.mg-toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; margin-top: 1px; }
.mg-toggle input { display: none; }
.mg-toggle__track {
  position: absolute; inset: 0;
  background: #1e2535; border: 1px solid #2a3146;
  border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s;
}
.mg-toggle__track::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #7a86a0; border-radius: 50%;
  top: 3px; left: 3px; transition: transform .2s, background .2s;
}
.mg-toggle input:checked + .mg-toggle__track {
  background: rgba(0,212,170,.12); border-color: #00d4aa;
}
.mg-toggle input:checked + .mg-toggle__track::after {
  transform: translateX(18px); background: #00d4aa;
}
.mg-toggle__label { font-size: 13px; font-weight: 500; color: #e2e8f4 !important; }

/* ── Radios ───────────────────────────────────────────── */
.mg-radios { display: flex; gap: 16px; flex-wrap: wrap; }
.mg-radio { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.mg-radio input[type="radio"] { accent-color: #00d4aa; }

/* ── Preset buttons ───────────────────────────────────── */
.mg-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.mg-preset-btn {
  padding: 7px 14px; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500;
  background: #1e2535; border: 1px solid #2a3146;
  border-radius: 6px; color: #7a86a0;
  cursor: pointer; transition: all .15s;
}
.mg-preset-btn:hover,
.mg-preset-btn.is-active {
  background: rgba(0,212,170,.12);
  border-color: #00d4aa;
  color: #00d4aa;
}

/* ── Buttons ──────────────────────────────────────────── */
.mg-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px; font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600; border-radius: 6px;
  cursor: pointer; border: 1px solid transparent; transition: all .15s;
  line-height: 1; text-decoration: none;
}
.mg-btn--primary {
  background: #00d4aa; color: #0f1117; border-color: #00d4aa;
}
.mg-btn--primary:hover { background: #00f0c2; color: #0f1117; }
.mg-btn--secondary {
  background: #1e2535; color: #e2e8f4; border-color: #2a3146;
}
.mg-btn--secondary:hover { border-color: #00d4aa; color: #00d4aa; }
.mg-btn--ghost { background: transparent; color: #7a86a0; border-color: transparent; }
.mg-btn--ghost:hover { color: #e2e8f4; }
.mg-btn-icon {
  background: none; border: none; cursor: pointer; font-size: 14px;
  opacity: .5; transition: opacity .15s; padding: 4px;
}
.mg-btn-icon:hover { opacity: 1; }

/* ── Actions row ──────────────────────────────────────── */
.mg-actions { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.mg-feedback {
  font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 6px;
}
.mg-feedback--ok  { background: rgba(52,211,153,.15); color: #34d399; }
.mg-feedback--err { background: rgba(255,77,106,.12); color: #ff4d6a; }

/* ── Notices ──────────────────────────────────────────── */
.mg-notice {
  padding: 12px 16px; border-radius: 6px;
  font-size: 13px; margin: 12px 0; line-height: 1.5;
}
.mg-notice--info { background: rgba(0,212,170,.12); color: #00d4aa; border-left: 3px solid #00d4aa; }
.mg-notice a { color: inherit; }

/* ── Filters bar ──────────────────────────────────────── */
.mg-filters {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.mg-filters__count { margin-left: auto; font-size: 12px; color: #7a86a0; }

/* ── Pagination ───────────────────────────────────────── */
.mg-pagination { display: flex; gap: 6px; justify-content: center; padding-top: 20px; }
.mg-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  font-size: 13px; color: #7a86a0; text-decoration: none;
  border: 1px solid #2a3146; transition: all .15s;
}
.mg-page-btn:hover { border-color: #00d4aa; color: #00d4aa; }
.mg-page-btn.is-current { background: #00d4aa; color: #0f1117; border-color: #00d4aa; font-weight: 700; }

/* ── Chart ────────────────────────────────────────────── */
.mg-chart-wrap { padding: 8px 0; }

/* ── Quick links ──────────────────────────────────────── */
.mg-quicklinks { display: flex; gap: 12px; flex-wrap: wrap; }
.mg-quicklink {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: #161b27; border: 1px solid #2a3146;
  border-radius: 6px; font-size: 13px; font-weight: 500;
  color: #e2e8f4; text-decoration: none; transition: all .15s;
}
.mg-quicklink:hover { border-color: #00d4aa; color: #00d4aa; }

/* ── Misc ─────────────────────────────────────────────── */
.mg-divider  { border: 0; border-top: 1px solid #2a3146; margin: 24px 0; }
.mg-muted    { color: #7a86a0; }
.mg-nowrap   { white-space: nowrap; }
.mg-hidden   { display: none !important; }
.mg-link     { color: #00d4aa; text-decoration: none; font-size: 13px; }
.mg-link:hover { text-decoration: underline; }
.mg-empty    { text-align: center; color: #7a86a0; padding: 40px 0; font-size: 14px; }
.mg-error-msg { font-size: 11px; color: #ff4d6a; margin-top: 4px; font-family: 'DM Mono', monospace; }

/* ── Dashboard widget ─────────────────────────────────── */
.mg-widget { font-family: 'DM Sans', -apple-system, sans-serif; }
.mg-widget__stats  { display: flex; gap: 20px; margin-bottom: 10px; }
.mg-widget__stat   { display: flex; flex-direction: column; }
.mg-widget__num    { font-size: 24px; font-weight: 700; color: #1d2327; }
.mg-widget__lbl    { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.mg-widget__stat--fail .mg-widget__num { color: #d63638; }
.mg-widget__stat--ok   .mg-widget__num { color: #00a32a; }
.mg-widget__period { color: #888; font-size: 12px; margin: 0 0 8px; }
.mg-widget__link   { font-size: 12px; color: #0073aa; text-decoration: none; }
.mg-widget__link:hover { text-decoration: underline; }

/* ── v1.1 additions ───────────────────────────────────── */

/* Resend badge on log entries */
.mg-resend-badge {
  display: inline-flex; align-items: center;
  margin-left: 6px; padding: 2px 7px;
  background: rgba(0,212,170,.15); color: #00d4aa;
  border-radius: 999px; font-size: 11px; font-weight: 600;
}

/* Email type badge */
.mg-type-badge {
  display: inline-block; padding: 3px 9px;
  background: #1e2535; border: 1px solid #2a3146;
  border-radius: 6px; font-size: 11px; color: #7a86a0;
  font-family: 'DM Mono', monospace;
}

/* Row actions cell */
.mg-row-actions { white-space: nowrap; }

/* Code block for webhook payload preview */
.mg-code {
  background: #0f1117; border: 1px solid #2a3146;
  border-radius: 6px; padding: 16px;
  font-family: 'DM Mono', monospace; font-size: 12px; color: #7a86a0;
  overflow-x: auto; line-height: 1.6; margin-top: 10px;
  white-space: pre;
}

/* Network rate bar */
.mg-rate-bar {
  height: 4px; background: #2a3146;
  border-radius: 2px; width: 80px; margin-bottom: 4px;
  overflow: hidden;
}
.mg-rate-bar__fill {
  height: 100%; border-radius: 2px;
  transition: width .4s ease;
}

/* Search input wider */
.mg-input--search { min-width: 220px; }

/* Slack/webhook result notices */
#mg-slack-result,
#mg-webhook-result {
  margin-top: 8px;
}
#mg-slack-result.ok,
#mg-webhook-result.ok {
  background: rgba(52,211,153,.15); color: #34d399;
  border-left: 3px solid #34d399; padding: 10px 14px;
  border-radius: 6px;
}
#mg-slack-result.err,
#mg-webhook-result.err {
  background: rgba(255,77,106,.12); color: #ff4d6a;
  border-left: 3px solid #ff4d6a; padding: 10px 14px;
  border-radius: 6px;
}

/* ── Upgrade page ─────────────────────────────────────── */
.mg-upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.mg-plan {
  background: #161b27;
  border: 1px solid #2a3146;
  border-radius: 10px;
  padding: 28px 24px;
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
}
.mg-plan--pro   { border-color: #00d4aa; box-shadow: 0 0 0 1px #00d4aa; }
.mg-plan--agency { border-color: #f5a623; }
.mg-plan__badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  background: #1e2535; color: #7a86a0;
  width: fit-content;
}
.mg-plan__badge--hot    { background: rgba(0,212,170,.12); color: #00d4aa; }
.mg-plan__badge--agency { background: rgba(245,166,35,.12);   color: #f5a623; }
.mg-plan__name  { font-size: 22px; font-weight: 700; margin: 0; }
.mg-plan__price { font-size: 28px; font-weight: 800; color: #00d4aa; }
.mg-plan__price span { font-size: 13px; font-weight: 400; color: #7a86a0; }
.mg-plan--agency .mg-plan__price { color: #f5a623; }
.mg-plan__features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.mg-feat { font-size: 13px; }
.mg-feat--yes { color: #e2e8f4; }
.mg-feat--no  { color: #7a86a0; text-decoration: line-through; opacity: .6; }
.mg-plan__cta { width: 100%; justify-content: center; margin-top: 8px; }
.mg-upgrade-note {
  font-size: 13px; color: #7a86a0; text-align: center;
  padding: 16px; background: #161b27; border-radius: 10px;
  border: 1px solid #2a3146;
}

/* ── Pro upsell banner ────────────────────────────────── */
.mg-pro-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(0,212,170,.08), rgba(0,212,170,.03));
  border: 1px solid rgba(0,212,170,.25); border-radius: 10px;
}
.mg-pro-banner__text { flex: 1; font-size: 13px; color: #7a86a0; }
.mg-pro-banner__text strong { color: #e2e8f4; }
