/* ================================================================
   XOL Industries — Admin Dashboard Stylesheet v3.0
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul { list-style: none; }

:root {
  --white:      #ffffff;
  --off-white:  #f2f2f2;
  --light-grey: #cccccc;
  --mid-grey:   #888888;
  --dark-grey:  #333333;
  --near-black: #181818;
  --panel:      #141414;
  --black:      #0a0a0a;
  --accent:     #89c4f4;
  --accent-dim: rgba(137,196,244,0.12);
  --sidebar-w:  240px;
  --error:      #ff6b6b;
  --warn:       #f5a623;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  font-family: var(--font);
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1,h2,h3,h4 { font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
p { line-height: 1.7; color: var(--light-grey); }

/* ── Login Gate ── */
#login-gate {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--black);
  padding: 24px;
}
.login-box {
  width: 100%; max-width: 380px;
}
.login-logo {
  margin-bottom: 48px;
}
.logo-img {
  display: block;
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}
.login-box h1 { font-size: 26px; margin-bottom: 8px; }
.login-box p  { font-size: 14px; color: var(--mid-grey); margin-bottom: 32px; }

.form-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.form-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--mid-grey);
}
.form-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--white); font-size: 14px; font-family: var(--font);
  padding: 12px 16px; border-radius: 4px; outline: none; width: 100%;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: rgba(255,255,255,0.3); }
.form-input::placeholder { color: rgba(255,255,255,0.18); }

.login-error {
  font-size: 13px; color: var(--error);
  margin-bottom: 12px; display: none;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  padding: 12px 22px; border-radius: 4px;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.25s var(--ease); white-space: nowrap;
}
.btn-sm   { padding: 8px 16px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-white { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-white:hover { background: var(--off-white); }
.btn-outline {
  background: transparent; color: var(--white);
  border-color: rgba(255,255,255,0.22);
}
.btn-outline:hover { border-color: rgba(255,255,255,0.5); }
.btn-accent { background: var(--accent); color: var(--black); font-weight: 600; }
.btn-accent:hover { background: #6db5f0; }
.btn-danger { background: rgba(255,107,107,0.1); color: var(--error); border-color: rgba(255,107,107,0.2); }
.btn-danger:hover { background: rgba(255,107,107,0.2); }
.btn-ghost { background: rgba(255,255,255,0.04); color: var(--mid-grey); border-color: rgba(255,255,255,0.08); }
.btn-ghost:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Admin Shell ── */
#admin-shell { display: none; min-height: 100vh; }
#admin-shell.visible {
  display: flex;
  flex-direction: row;
}

/* ── Sidebar ── */
.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
  display: flex; align-items: center;
}
.sidebar-logo .logo-img { height: 30px; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-section-ttl {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.2);
  padding: 16px 20px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 13px; font-weight: 400; color: var(--mid-grey);
  border-left: 2px solid transparent;
  transition: all 0.2s; cursor: pointer;
}
.sidebar-link i { width: 16px; font-size: 13px; flex-shrink: 0; }
.sidebar-link:hover { color: var(--white); background: rgba(255,255,255,0.03); }
.sidebar-link.active {
  color: var(--white);
  border-left-color: var(--accent);
  background: rgba(137,196,244,0.06);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer a {
  font-size: 12px; color: var(--mid-grey);
  display: flex; align-items: center; gap: 8px;
  transition: color 0.2s;
}
.sidebar-footer a:hover { color: var(--white); }
.admin-user-info {
  font-size: 11px; color: rgba(255,255,255,0.3);
  margin-bottom: 12px; padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 3px;
}
.admin-user-info strong { color: var(--mid-grey); display: block; font-size: 12px; margin-bottom: 2px; }

/* ── Main Content ── */
.admin-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.admin-topbar {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar-title {
  font-size: 15px; font-weight: 600; color: var(--white); letter-spacing: -0.01em;
}
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }

.admin-body { padding: 32px; flex: 1; }

/* ── Sections (tabs) ── */
.admin-section { display: none; }
.admin-section.active { display: block; }

.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.section-hdr-left h2 {
  font-size: 20px; font-weight: 700; color: var(--white); letter-spacing: -0.02em;
}
.section-hdr-left p { font-size: 13px; color: var(--mid-grey); margin: 4px 0 0; }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 32px;
}
.stat-card {
  background: var(--near-black);
  padding: 24px 20px; display: flex; flex-direction: column; gap: 8px;
}
.stat-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--mid-grey);
}
.stat-num {
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.04em; color: var(--white); line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--mid-grey); }
.stat-card.highlight { background: rgba(137,196,244,0.04); border: 1px solid rgba(137,196,244,0.18); }
.stat-card.highlight .stat-num { color: var(--accent); }

/* ── Data Tables ── */
.data-table-wrap {
  background: var(--near-black);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px; overflow: hidden;
}
.data-table-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.07);
  gap: 12px; flex-wrap: wrap;
}
.data-table-title { font-size: 14px; font-weight: 600; color: var(--white); }
.data-table-search {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--white); font-size: 13px;
  padding: 7px 12px; border-radius: 3px; outline: none;
  transition: border-color 0.2s; width: 200px;
}
.data-table-search:focus { border-color: rgba(255,255,255,0.22); }
.data-table-search::placeholder { color: rgba(255,255,255,0.2); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--mid-grey);
  padding: 12px 20px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: left; white-space: nowrap;
}
.data-table td {
  padding: 13px 20px;
  font-size: 13px; color: rgba(255,255,255,0.75);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.table-empty {
  padding: 48px 20px; text-align: center;
  font-size: 13px; color: rgba(255,255,255,0.2);
}

/* Badges */
.badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px;
  display: inline-block;
}
.badge-active  { background: rgba(137,196,244,0.12); color: var(--accent); }
.badge-revoked { background: rgba(255,107,107,0.1); color: var(--error); }
.badge-pending { background: rgba(245,166,35,0.1);  color: var(--warn); }
.badge-signed  { background: rgba(100,200,100,0.1); color: #6cdf6c; }

/* Copy button */
.copy-btn {
  font-size: 11px; color: var(--mid-grey);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 3px;
  background: rgba(255,255,255,0.04);
  transition: all 0.2s;
}
.copy-btn:hover { color: var(--white); background: rgba(255,255,255,0.08); }

/* Code/token display */
.token-code {
  font-family: 'Courier New', monospace; font-size: 12px;
  letter-spacing: 0.08em; color: var(--accent);
  background: var(--accent-dim); padding: 2px 8px; border-radius: 2px;
}

/* ── Generate Token Form ── */
.gen-form {
  background: var(--near-black);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px; padding: 24px; margin-bottom: 24px;
}
.gen-form h3 { font-size: 15px; font-weight: 600; color: var(--white); margin-bottom: 18px; }
.gen-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.gen-form .form-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--white); font-size: 14px; font-family: var(--font);
  padding: 11px 14px; border-radius: 4px; outline: none; width: 100%;
  appearance: none; cursor: pointer;
  transition: border-color 0.2s;
}
.gen-form .form-select:focus { border-color: rgba(255,255,255,0.28); }
.gen-form .form-select option { background: var(--near-black); }

.new-token-result {
  display: none;
  margin-top: 16px; padding: 16px 18px;
  border: 1px solid rgba(137,196,244,0.25);
  background: rgba(137,196,244,0.04); border-radius: 4px;
}
.new-token-result p { font-size: 13px; color: var(--mid-grey); margin-bottom: 10px; }
.new-token-display {
  font-family: 'Courier New', monospace; font-size: 18px;
  font-weight: 700; letter-spacing: 0.1em; color: var(--accent);
  display: block; margin-bottom: 10px;
}

/* ── Activity Feed ── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mid-grey); flex-shrink: 0; margin-top: 4px;
}
.activity-dot.green   { background: var(--accent); }
.activity-dot.orange  { background: var(--warn); }
.activity-dot.red     { background: var(--error); }
.activity-text {
  font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.55; flex: 1;
}
.activity-time { font-size: 11px; color: rgba(255,255,255,0.25); white-space: nowrap; margin-top: 1px; }

/* ── Spinner ── */
.spinner-row { display: flex; justify-content: center; padding: 40px; }
.spinner {
  width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--near-black); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; padding: 12px 18px;
  font-size: 13px; color: var(--white);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  transform: translateY(12px); opacity: 0;
  transition: all 0.3s var(--ease);
  max-width: 320px; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; pointer-events: all; }
.toast-ico { font-size: 14px; }
.toast.success .toast-ico { color: var(--accent); }
.toast.error   .toast-ico { color: var(--error); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .admin-sidebar.open { transform: none; }
  .admin-content { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .gen-form .form-row { grid-template-columns: 1fr; }
  .admin-body { padding: 20px 16px; }
  .data-table th, .data-table td { padding: 10px 14px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
