/* ============================================================
   Wildcat Blockchain — Global Stylesheet
   Theme: Dark mode · Wildcat Purple (#512888)
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colours */
  --bg-primary:      #0b0c10;
  --bg-secondary:    #121212;
  --bg-card:         #1a1b22;
  --bg-input:        #0f1015;
  --bg-table-row:    #1e1f28;
  --bg-table-alt:    #16171f;

  --purple-deep:     #3d1e66;
  --purple-main:     #512888;
  --purple-glow:     #6f3aa2;
  --purple-light:    #9b59d6;
  --purple-faint:    rgba(81, 40, 136, 0.18);

  --text-primary:    #e8e8f0;
  --text-secondary:  #9a9ab0;
  --text-muted:      #5a5a72;
  --text-danger:     #e05555;
  --text-success:    #4caf80;
  --text-warning:    #f0a500;

  --border-default:  #2a2b38;
  --border-focus:    var(--purple-glow);

  /* Sizing */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  /* Shadow / Glow */
  --glow-card:   0 0 0 1px var(--purple-main), 0 0 24px rgba(111, 58, 162, 0.35), 0 8px 32px rgba(0,0,0,.6);
  --glow-focus:  0 0 0 3px rgba(111, 58, 162, 0.45);
  --shadow-btn:  0 4px 14px rgba(81, 40, 136, 0.5);

  /* Typography */
  --font-sans:  'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Links ───────────────────────────────────────────────── */
a {
  color: var(--purple-light);
  text-decoration: none;
  transition: color .2s;
}
a:hover { color: #b980e8; text-decoration: underline; }

/* ── Layout Utilities ────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(81,40,136,.18) 0%, transparent 70%),
    var(--bg-primary);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow-card);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
}

.card--wide { max-width: 900px; }

.card__header {
  text-align: center;
  margin-bottom: 2rem;
}

.card__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--purple-faint);
  border: 1px solid var(--purple-main);
  border-radius: 50%;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.card__title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-primary);
}

.card__subtitle {
  margin-top: .35rem;
  font-size: .875rem;
  color: var(--text-secondary);
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: .45rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  display: block;
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--glow-focus);
}

input::placeholder { color: var(--text-muted); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a9ab0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

select option { background: var(--bg-card); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .72rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--purple-main);
  color: #fff;
  width: 100%;
  padding: .85rem;
  font-size: 1rem;
  box-shadow: var(--shadow-btn);
}

.btn--primary:hover {
  background: var(--purple-glow);
  box-shadow: 0 6px 20px rgba(111, 58, 162, 0.65);
}

.btn--primary:disabled {
  background: var(--purple-deep);
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--secondary {
  background: transparent;
  color: var(--purple-light);
  border: 1px solid var(--purple-main);
}

.btn--secondary:hover {
  background: var(--purple-faint);
  border-color: var(--purple-glow);
}

.btn--danger {
  background: rgba(220, 53, 69, .15);
  color: #e05555;
  border: 1px solid rgba(220, 53, 69, .4);
  font-size: .82rem;
  padding: .4rem .8rem;
}

.btn--danger:hover {
  background: rgba(220, 53, 69, .28);
  border-color: #e05555;
}

.btn--sm {
  font-size: .82rem;
  padding: .42rem .9rem;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* ── Alert / Message Banners ─────────────────────────────── */
.alert {
  display: none;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid;
}

.alert.is-visible { display: block; }

.alert--error {
  background: rgba(224, 85, 85, .12);
  border-color: var(--text-danger);
  color: #f08080;
}

.alert--success {
  background: rgba(76, 175, 128, .12);
  border-color: var(--text-success);
  color: #70d0a0;
}

.alert--warning {
  background: rgba(240, 165, 0, .12);
  border-color: var(--text-warning);
  color: #f5c040;
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}

.spinner.is-visible { display: inline-block; }

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

/* ── Badge / Pill ────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge--admin { background: rgba(111,58,162,.3); color: var(--purple-light); border: 1px solid var(--purple-main); }
.badge--tier1 { background: rgba(76,130,175,.2); color: #6ab0e8; border: 1px solid #3a6a99; }
.badge--tier2 { background: rgba(76,175,130,.15); color: #5dd4a0; border: 1px solid #2e7a5a; }
.badge--tier3 { background: rgba(80,80,100,.25); color: var(--text-secondary); border: 1px solid #3a3a52; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  margin-top: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  background: var(--bg-secondary);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

tbody tr {
  background: var(--bg-table-row);
  transition: background .15s;
}

tbody tr:nth-child(even) { background: var(--bg-table-alt); }
tbody tr:hover { background: rgba(81,40,136,.12); }

tbody td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border-default);
  vertical-align: middle;
  color: var(--text-primary);
}

tbody tr:last-child td { border-bottom: none; }

td code {
  font-family: var(--font-mono);
  font-size: .78rem;
  background: rgba(255,255,255,.06);
  padding: .15rem .4rem;
  border-radius: 4px;
  color: var(--purple-light);
}

/* ── Admin Header ─────────────────────────────────────────── */
.admin-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-header__brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-header__brand span {
  width: 32px;
  height: 32px;
  background: var(--purple-faint);
  border: 1px solid var(--purple-main);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}

.admin-header__user {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  color: var(--text-secondary);
}

/* ── Admin Page Layout ───────────────────────────────────── */
.admin-page { min-height: 100vh; background: var(--bg-primary); }

.admin-content { padding: 2rem 0 4rem; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1rem;
  background: var(--purple-main);
  border-radius: 2px;
}

/* ── Add User Form (inline grid) ─────────────────────────── */
.add-user-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  align-items: end;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.add-user-form .form-group { margin-bottom: 0; }

.add-user-form .btn {
  align-self: end;
  height: 42px;
  width: 100%;
}

/* ── Stats Bar ───────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: .9rem 1.25rem;
  flex: 1;
  min-width: 130px;
}

.stat-card__label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .25rem;
}

.stat-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--purple-light);
  line-height: 1.2;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .card { padding: 1.75rem 1.25rem; }

  .admin-header__user .btn { display: none; }

  .add-user-form { grid-template-columns: 1fr; }

  .stats-bar { flex-direction: column; }
}
