/*
 * DW Analytics — common.css
 * Shared theme + primitives used by every non-dashboard page
 * (login, account, error, forbidden, alert_ack, admin_users, admin_alerts).
 * The main dashboard imports its own dashboard.css instead.
 */

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

:root {
  --bg:        #0f0f11;
  --surface:   #18181c;
  --surface2:  #212126;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --text:      #f0f0f2;
  --muted:     #888892;
  --accent:    #e05454;
  --accent2:   #2ecc9a;
  --warn:      #e07b3a;
  --danger:    #e05050;
  --mono:      'DM Mono', monospace;
  --sans:      'DM Sans', system-ui, sans-serif;
  --radius:    10px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: rgba(255,255,255,0.2); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { opacity: .88; background: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: rgba(224,80,80,0.08); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
}
.flash-ok    { background: rgba(46,204,154,0.10); color: var(--accent2); border: 1px solid rgba(46,204,154,0.25); }
.flash-error { background: rgba(224,80,80,0.08);  color: var(--danger);  border: 1px solid rgba(224,80,80,0.25); }

/* ── Form inputs (text + password) ───────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="date"] {
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--accent); }

select {
  font-family: var(--sans);
  font-size: 13px;
  padding: 5px 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
select:focus    { border-color: var(--accent); }
select:disabled { opacity: .5; cursor: not-allowed; }
select option   { background: var(--surface2); color: var(--text); }

/* ── Password show/hide toggle (admin_users.html + account.html) ──────────── */
.pw-wrap { position: relative; display: inline-block; }
.pw-wrap input { padding-right: 34px !important; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color .12s, background .12s;
}
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.pw-toggle svg { width: 16px; height: 16px; }
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.pw-shown .icon-eye     { display: none; }
.pw-toggle.pw-shown .icon-eye-off { display: inline; }

/* ── Role badges (used in admin_users + account) ─────────────────────────── */
.role-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--muted);
  letter-spacing: .02em;
}
.role-badge.admin { background: rgba(224,84,84,0.15); color: var(--accent); }
.role-badge.hq    { background: rgba(79,142,247,0.15); color: #6aa3f7; }

/* ── Common topbar (account / admin_users / admin_alerts) ────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.topbar .brand .logo-mark { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.topbar .brand .page-title { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.topbar-right {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.topbar-right a { color: var(--accent); text-decoration: none; }
.topbar-right a:hover { text-decoration: underline; }
.topbar-right a.muted { color: var(--muted); }
.topbar-right a.muted:hover { color: var(--accent); text-decoration: none; }

/* ── Helper: small "(you)" tag next to the current user's row ─────────────── */
.self-tag { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* ── Checkbox label ──────────────────────────────────────────────────────── */
label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
