/* ─────────────────────────────────────────────────────────────────────────────
 * elevate_rights.css — MUMS Elevate Rights (Temporary Admin) UI
 * Scope: bottom-bar trigger button, request modal, re-login prompt, countdown
 * banner, Windows-style "New Files Added" toast, and the Super-Admin logs viewer.
 * Theme-token driven so it tracks the active MUMS theme. All classes are `er-`
 * prefixed to avoid collisions with existing surfaces.
 * ───────────────────────────────────────────────────────────────────────────── */

:root {
  --er-accent: var(--accent-primary, var(--accent, #4ea1ff));
  --er-accent-rgb: var(--accent-rgb, 78, 161, 255);
  --er-panel: var(--card, var(--bg2, #131a26));
  --er-panel-2: var(--card2, var(--bg, #0d131c));
  --er-border: var(--border, rgba(255, 255, 255, .10));
  --er-text: var(--text, #e8eef7);
  --er-muted: var(--muted, var(--text-muted, #8da0b8));
  --er-danger: var(--danger, #ff5d6c);
  --er-warn: var(--warn, #ffb454);
  --er-ok: var(--status-success, #36d399);
  --er-radius: 14px;
}

/* ── Trigger button — the Elevate_Rights.png artwork IS the button ──────────────
 * Mounted as an absolutely-positioned child of the FIXED online bar so it sits at
 * the left edge without joining (and breaking) the bar's 4-column shift grid. */
.er-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  margin: 0; padding: 0; border: 0; background: transparent;
  line-height: 0; border-radius: 11px; cursor: pointer;
  transition: transform .15s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.er-btn:hover { transform: translateY(-50%) scale(1.045); }
.er-btn:active { transform: translateY(-50%) scale(.99); }
.er-btn:focus-visible { outline: 2px solid var(--er-accent); outline-offset: 4px; }
.er-btn__img {
  display: block;
  height: 46px;            /* fits the bar (~56px tall); width auto-scales (~4.45:1) */
  width: auto;
  border-radius: 11px;
  user-select: none;
  pointer-events: none;    /* clicks land on the <button>, not the <img> */
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .5));
}
.er-btn:hover .er-btn__img { filter: drop-shadow(0 6px 18px rgba(var(--er-accent-rgb), .5)); }
/* Active-elevation state: amber glow pulse around the artwork */
.er-btn.is-elevated .er-btn__img { animation: er-elevpulse 2.4s ease-in-out infinite; }
@keyframes er-elevpulse {
  0%, 100% { filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .5)); }
  50%      { filter: drop-shadow(0 0 15px rgba(255, 180, 84, .8)) drop-shadow(0 3px 10px rgba(0, 0, 0, .5)); }
}
@media (max-width: 1500px) { .er-btn { left: 12px; } .er-btn__img { height: 40px; } }
@media (max-width: 1200px) { .er-btn__img { height: 34px; } }
@media (max-width: 768px)  { .er-btn { left: 10px; } .er-btn__img { height: 30px; } }

/* ── Shared overlay / modal ─────────────────────────────────────────────────── */
.er-overlay {
  position: fixed; inset: 0; z-index: 2147483000;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(0, 0, 0, .55), rgba(0, 0, 0, .78));
  backdrop-filter: blur(6px);
  padding: 24px;
  animation: er-fade .18s ease;
}
.er-overlay.is-open { display: flex; }
@keyframes er-fade { from { opacity: 0; } to { opacity: 1; } }

.er-modal {
  width: min(560px, 96vw);
  max-height: 90vh; overflow: auto;
  background: linear-gradient(180deg, var(--er-panel), var(--er-panel-2));
  border: 1px solid var(--er-border);
  border-radius: var(--er-radius);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--er-accent-rgb), .08);
  color: var(--er-text);
  animation: er-pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.er-modal.er-wide { width: min(960px, 97vw); }
@keyframes er-pop { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.er-modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--er-border);
}
.er-modal__icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: radial-gradient(120% 120% at 30% 20%, rgba(var(--er-accent-rgb), .35), rgba(var(--er-accent-rgb), .08));
  border: 1px solid rgba(var(--er-accent-rgb), .45);
}
.er-modal__icon svg { width: 22px; height: 22px; stroke: var(--er-accent); }
.er-modal__titles { flex: 1 1 auto; min-width: 0; }
.er-modal__eyebrow { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--er-accent); font-weight: 800; }
.er-modal__title { font-size: 18px; font-weight: 800; margin: 2px 0 0; }
.er-modal__note {
  margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--er-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.er-modal__note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--er-ok); box-shadow: 0 0 8px var(--er-ok); }
.er-modal__x {
  appearance: none; border: 1px solid var(--er-border); background: transparent;
  color: var(--er-muted); width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; flex: 0 0 auto; transition: .15s;
}
.er-modal__x:hover { color: var(--er-text); border-color: rgba(255, 255, 255, .3); }
.er-modal__body { padding: 20px; }
.er-modal__foot {
  padding: 16px 20px; border-top: 1px solid var(--er-border);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

.er-field-label { font-size: 12px; font-weight: 700; color: var(--er-muted); margin: 0 0 7px; display: block; }
.er-textarea {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--control-bg, rgba(0, 0, 0, .25));
  border: 1px solid var(--control-border, var(--er-border));
  border-radius: 10px; padding: 12px 14px;
  color: var(--control-text, var(--er-text)); font: 400 14px/1.5 var(--font, inherit);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.er-textarea:focus { border-color: var(--er-accent); box-shadow: 0 0 0 3px rgba(var(--er-accent-rgb), .18); }
.er-hint { font-size: 12px; color: var(--er-muted); margin: 10px 0 0; line-height: 1.5; }
.er-callout {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: rgba(var(--er-accent-rgb), .08); border: 1px solid rgba(var(--er-accent-rgb), .25);
  font-size: 12.5px; line-height: 1.55; color: var(--er-text);
}
.er-callout b { color: var(--er-accent); }
.er-msg { font-size: 12.5px; margin: 12px 0 0; min-height: 16px; }
.er-msg.is-ok { color: var(--er-ok); }
.er-msg.is-bad { color: var(--er-danger); }

/* ── Ultra-premium Request modal ───────────────────────────────────────────────
 * Layered glass surface, animated accent aura on the header icon, at-a-glance
 * session facts, a metered reason field, unlocked-surface cards and a security
 * notice. Scoped under .er-modal--premium so other modals keep their base look. */
.er-modal--premium {
  position: relative;            /* keep base `overflow:auto` so tall content scrolls */
  background:
    radial-gradient(140% 100% at 0% 0%, rgba(var(--er-accent-rgb), .14), transparent 46%),
    radial-gradient(120% 90% at 100% 0%, rgba(var(--er-accent-rgb), .08), transparent 50%),
    linear-gradient(180deg, var(--er-panel), var(--er-panel-2));
  box-shadow: 0 40px 110px rgba(0, 0, 0, .66), 0 0 0 1px rgba(var(--er-accent-rgb), .14), inset 0 1px 0 rgba(255, 255, 255, .05);
}
/* Top accent hairline */
.er-modal--premium::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(var(--er-accent-rgb), .85), transparent);
  opacity: .8;
}
.er-modal--premium .er-modal__head {
  background: linear-gradient(180deg, rgba(var(--er-accent-rgb), .07), transparent);
}
.er-modal--premium .er-modal__icon {
  position: relative;
  background: radial-gradient(120% 120% at 30% 18%, rgba(var(--er-accent-rgb), .5), rgba(var(--er-accent-rgb), .1));
  box-shadow: 0 0 0 1px rgba(var(--er-accent-rgb), .5), 0 8px 22px rgba(var(--er-accent-rgb), .3);
  animation: er-iconaura 3.4s ease-in-out infinite;
}
@keyframes er-iconaura {
  0%, 100% { box-shadow: 0 0 0 1px rgba(var(--er-accent-rgb), .5), 0 8px 22px rgba(var(--er-accent-rgb), .3); }
  50%      { box-shadow: 0 0 0 1px rgba(var(--er-accent-rgb), .7), 0 8px 30px rgba(var(--er-accent-rgb), .55); }
}

.er-req { display: flex; flex-direction: column; gap: 16px; }
.er-req__lead { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--er-text); }
.er-req__lead b { color: var(--er-accent); }

/* At-a-glance session facts */
.er-req__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.er-stat {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 12px 13px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
  border: 1px solid var(--er-border);
}
.er-stat__ic {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center;
  background: rgba(var(--er-accent-rgb), .12); border: 1px solid rgba(var(--er-accent-rgb), .28);
}
.er-stat__ic svg { width: 16px; height: 16px; stroke: var(--er-accent); }
.er-stat__meta { min-width: 0; }
.er-stat__v { font-size: 14px; font-weight: 800; line-height: 1.1; color: var(--er-text); }
.er-stat__k { font-size: 10.5px; font-weight: 600; color: var(--er-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Metered reason field */
.er-field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.er-field-row .er-field-label { margin: 0; }
.er-counter { font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--er-muted); flex: 0 0 auto; transition: color .15s; }
.er-counter.is-low { color: var(--er-warn); }
.er-counter.is-near { color: var(--er-danger); }

/* Unlocked-surface cards */
.er-scope-title { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--er-muted); margin-bottom: 9px; }
.er-scope-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.er-scopecard {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 13px 13px 14px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(var(--er-accent-rgb), .08), rgba(var(--er-accent-rgb), .02));
  border: 1px solid rgba(var(--er-accent-rgb), .22);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.er-scopecard:hover { transform: translateY(-2px); border-color: rgba(var(--er-accent-rgb), .42); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }
.er-scopecard__ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(var(--er-accent-rgb), .16); border: 1px solid rgba(var(--er-accent-rgb), .34); }
.er-scopecard__ic svg { width: 15px; height: 15px; stroke: var(--er-accent); }
.er-scopecard__t { font-size: 13px; font-weight: 800; color: var(--er-text); line-height: 1.2; }
.er-scopecard__d { font-size: 11px; line-height: 1.45; color: var(--er-muted); }
.er-scopecard__chk { position: absolute; top: 11px; right: 11px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(54, 211, 153, .16); border: 1px solid rgba(54, 211, 153, .4); }
.er-scopecard__chk svg { width: 11px; height: 11px; stroke: var(--er-ok); }

/* Security notice */
.er-notice {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: 12px;
  background: rgba(255, 180, 84, .08); border: 1px solid rgba(255, 180, 84, .3);
}
.er-notice__ic { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 180, 84, .14); border: 1px solid rgba(255, 180, 84, .34); }
.er-notice__ic svg { width: 16px; height: 16px; stroke: var(--er-warn); }
.er-notice__txt { font-size: 12.5px; line-height: 1.55; color: var(--er-text); }
.er-notice__txt b { color: var(--er-warn); }

@media (max-width: 560px) {
  .er-req__stats, .er-scope-grid { grid-template-columns: 1fr; }
}

/* Scope chips */
.er-scope { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.er-chip {
  font-size: 11.5px; font-weight: 700; padding: 6px 11px; border-radius: 999px;
  background: rgba(var(--er-accent-rgb), .1); border: 1px solid rgba(var(--er-accent-rgb), .3);
  color: var(--er-text); display: inline-flex; align-items: center; gap: 6px;
}

/* Buttons */
.er-bt {
  appearance: none; cursor: pointer; font: 700 13px/1 var(--font, inherit);
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--er-border);
  background: transparent; color: var(--er-text); transition: .15s; display: inline-flex; align-items: center; gap: 8px;
}
.er-bt:hover { border-color: rgba(255, 255, 255, .3); }
.er-bt:disabled { opacity: .55; cursor: not-allowed; }
.er-bt--primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--er-accent), color-mix(in srgb, var(--er-accent) 78%, black));
  color: var(--accent-contrast, #04121f);
  box-shadow: 0 6px 18px rgba(var(--er-accent-rgb), .35);
}
.er-bt--primary:hover { filter: brightness(1.06); border-color: transparent; }
.er-bt--ok { border-color: transparent; background: linear-gradient(180deg, var(--er-ok), color-mix(in srgb, var(--er-ok) 75%, black)); color: #04130d; }
.er-bt--danger { border-color: rgba(255, 93, 108, .4); color: var(--er-danger); }
.er-bt svg { width: 16px; height: 16px; }

/* ── Countdown banner (page-agnostic, bottom-left) ─────────────────────────────
 * Docked to the bottom-left corner, floating just above the fixed Online Users
 * bar so it never overlaps the top menu/header panel. The offset tracks the same
 * theme vars the online bar uses (--mums-dock-h + --mums-onlinebar-h). */
.er-countdown {
  position: fixed;
  left: 16px;
  bottom: calc(var(--mums-dock-h, 86px) + var(--mums-onlinebar-h, 44px) + 14px);
  z-index: 2147482000; display: none; align-items: center; gap: 14px;
  padding: 9px 10px 9px 16px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(28, 22, 10, .96), rgba(20, 16, 8, .96));
  border: 1px solid rgba(255, 180, 84, .55);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 0 22px rgba(255, 180, 84, .22);
  color: var(--er-text); backdrop-filter: blur(8px);
  animation: er-rise .32s cubic-bezier(.2, .9, .3, 1.2);
}
.er-countdown.is-open { display: flex; }
@keyframes er-rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 980px) {
  /* Online bar collapses + lifts to bottom:10px on small screens — follow it. */
  .er-countdown { left: 12px; right: 12px; bottom: calc(var(--mums-dock-h, 86px) + var(--mums-onlinebar-h, 40px) + 16px); }
}
.er-countdown__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--er-warn); box-shadow: 0 0 10px var(--er-warn); animation: er-blink 1.4s infinite; }
@keyframes er-blink { 50% { opacity: .35; } }
.er-countdown__txt { display: flex; flex-direction: column; line-height: 1.2; }
.er-countdown__txt b { font-size: 12.5px; font-weight: 800; letter-spacing: .2px; }
.er-countdown__txt span { font-size: 10.5px; color: var(--er-muted); font-weight: 600; }
.er-countdown__clock {
  font: 800 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--er-warn); min-width: 58px; text-align: center;
  padding: 4px 8px; border-radius: 8px; background: rgba(255, 180, 84, .12);
}
.er-countdown.is-urgent .er-countdown__clock { color: var(--er-danger); background: rgba(255, 93, 108, .14); }
.er-countdown__done {
  appearance: none; cursor: pointer; border: 1px solid transparent; border-radius: 999px;
  background: linear-gradient(180deg, var(--er-ok), color-mix(in srgb, var(--er-ok) 75%, black));
  color: #04130d; font: 800 12px/1 var(--font, inherit); padding: 9px 14px; display: inline-flex; align-items: center; gap: 6px;
  transition: .15s;
}
.er-countdown__done:hover { filter: brightness(1.08); }
.er-countdown__done svg { width: 14px; height: 14px; }

/* ── Windows-style "New Files Added" toast (lower-right) ─────────────────────── */
.er-toast-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 2147481000;
  display: flex; flex-direction: column; gap: 12px; max-width: 380px; pointer-events: none;
}
.er-toast {
  pointer-events: auto;
  background: linear-gradient(180deg, var(--er-panel), var(--er-panel-2));
  border: 1px solid var(--er-border);
  border-left: 4px solid var(--er-accent);
  border-radius: 12px; padding: 14px 14px 14px 16px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .55);
  color: var(--er-text);
  animation: er-slidein .34s cubic-bezier(.2, .9, .3, 1.2);
}
.er-toast.is-leaving { animation: er-slideout .26s ease forwards; }
@keyframes er-slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes er-slideout { to { transform: translateX(40px); opacity: 0; } }
.er-toast__head { display: flex; align-items: center; gap: 10px; }
.er-toast__icon {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(var(--er-accent-rgb), .4), rgba(var(--er-accent-rgb), .1));
  border: 1px solid rgba(var(--er-accent-rgb), .45);
}
.er-toast__icon svg { width: 18px; height: 18px; stroke: var(--er-accent); }
.er-toast__title { font-size: 13.5px; font-weight: 800; flex: 1 1 auto; }
.er-toast__x { appearance: none; background: transparent; border: 0; color: var(--er-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.er-toast__x:hover { color: var(--er-text); }
.er-toast__msg { font-size: 12.5px; line-height: 1.5; color: var(--er-muted); margin: 8px 0 0; }
.er-toast__msg b { color: var(--er-text); }
.er-toast__actions { display: flex; gap: 8px; margin-top: 12px; }
.er-toast__btn {
  appearance: none; cursor: pointer; flex: 1 1 auto; font: 700 12px/1 var(--font, inherit);
  padding: 9px 12px; border-radius: 9px; border: 1px solid var(--er-border); background: transparent; color: var(--er-text); transition: .15s;
}
.er-toast__btn:hover { border-color: rgba(255, 255, 255, .3); }
.er-toast__btn--primary {
  border-color: transparent; color: var(--accent-contrast, #04121f);
  background: linear-gradient(180deg, var(--er-accent), color-mix(in srgb, var(--er-accent) 78%, black));
}

/* ── Right-click context menu (Super Admin) ─────────────────────────────────── */
.er-ctx {
  position: fixed; z-index: 2147483600; display: none; min-width: 210px;
  background: linear-gradient(180deg, var(--er-panel), var(--er-panel-2));
  border: 1px solid var(--er-border); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: er-pop .14s ease;
}
.er-ctx.is-open { display: block; }
.er-ctx__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 9px; cursor: pointer; color: var(--er-text);
  font: 600 13px/1 var(--font, inherit); background: transparent; border: 0; text-align: left;
}
.er-ctx__item:hover { background: rgba(var(--er-accent-rgb), .14); }
.er-ctx__item svg { width: 16px; height: 16px; stroke: var(--er-accent); flex: 0 0 auto; }

/* ── Logs viewer ────────────────────────────────────────────────────────────── */
.er-logs { display: flex; flex-direction: column; gap: 0; }
.er-logs__bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.er-logs__search {
  flex: 1 1 220px; min-width: 160px;
  background: var(--control-bg, rgba(0, 0, 0, .25)); border: 1px solid var(--er-border); border-radius: 9px;
  padding: 9px 12px; color: var(--er-text); font: 400 13px var(--font, inherit); outline: none;
}
.er-logs__search:focus { border-color: var(--er-accent); }
.er-logs__count { font-size: 12px; color: var(--er-muted); font-weight: 700; }
.er-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.er-table th {
  text-align: left; position: sticky; top: 0; z-index: 1;
  background: var(--er-panel-2); color: var(--er-muted); font-weight: 800; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .5px; padding: 9px 10px; border-bottom: 1px solid var(--er-border);
}
.er-table td { padding: 9px 10px; border-bottom: 1px solid var(--er-border); vertical-align: top; color: var(--er-text); }
.er-table tr:hover td { background: rgba(255, 255, 255, .03); }
.er-kind {
  display: inline-block; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px;
}
.er-kind--request { background: rgba(var(--er-accent-rgb), .16); color: var(--er-accent); }
.er-kind--activate { background: rgba(54, 211, 153, .16); color: var(--er-ok); }
.er-kind--write { background: rgba(255, 255, 255, .08); color: var(--er-text); }
.er-kind--complete { background: rgba(255, 180, 84, .16); color: var(--er-warn); }
.er-kind--expire { background: rgba(255, 93, 108, .16); color: var(--er-danger); }
.er-empty { padding: 36px 10px; text-align: center; color: var(--er-muted); font-size: 13px; }
.er-user { font-weight: 700; }
.er-time { color: var(--er-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 680px) {
  .er-table th:nth-child(2), .er-table td:nth-child(2) { display: none; }
}
