/* ============================================================
   style.css — DL Admin
   Theme: Black #000000 + Gold #FFD700
   All styles scoped under .adm-* to avoid conflicts
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&family=Orbitron:wght@700;900&display=swap');

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

:root {
  --adm-bg:          #000000;
  --adm-surface:     #111111;
  --adm-card:        #181818;
  --adm-card-hover:  #1f1f1f;
  --adm-border:      rgba(255, 215, 0, 0.15);
  --adm-border-dim:  rgba(255, 255, 255, 0.07);
  --adm-gold:        #FFD700;
  --adm-gold-dim:    rgba(255, 215, 0, 0.12);
  --adm-gold-glow:   rgba(255, 215, 0, 0.25);
  --adm-green:       #00C896;
  --adm-green-dim:   rgba(0, 200, 150, 0.12);
  --adm-red:         #FF4455;
  --adm-red-dim:     rgba(255, 68, 85, 0.12);
  --adm-text:        #F0F0F0;
  --adm-text-sub:    #A0A0A0;
  --adm-text-muted:  #555555;
  --adm-mono:        "JetBrains Mono", "Courier New", monospace;
  --adm-sans:        "Outfit", "Helvetica Neue", sans-serif;
  --adm-display:     "Space Grotesk", "Helvetica Neue", sans-serif;
  --adm-nav-h:       64px;
  --adm-header-h:    60px;
  --sat:             env(safe-area-inset-top, 24px);
  --sab:             env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--adm-bg);
  color: var(--adm-text);
  font-family: var(--adm-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   PAGE SYSTEM (SPA Show/Hide)
══════════════════════════════════════════ */
.adm-page {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--adm-bg);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.adm-page--active {
  display: flex;
  opacity: 1;
}

/* ══════════════════════════════════════════
   PAGE 1: LOGIN
══════════════════════════════════════════ */
.adm-login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(var(--sat) + 24px);
  position: relative;
  overflow: hidden;
}

.adm-login-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,215,0,0.08) 0%, transparent 70%);
  pointer-events: none;
  animation: loginGlowPulse 4s ease-in-out infinite;
}

@keyframes loginGlowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.15); }
}

.adm-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 24px;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 0 60px rgba(255,215,0,0.06), 0 20px 60px rgba(0,0,0,0.8);
}

.adm-login-crown {
  font-size: 48px;
  text-align: center;
  filter: drop-shadow(0 0 12px rgba(255,215,0,0.5));
}

.adm-login-title {
  font-family: var(--adm-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--adm-gold);
  text-align: center;
  letter-spacing: 0.04em;
}

.adm-login-sub {
  font-family: var(--adm-mono);
  font-size: 11px;
  color: var(--adm-text-sub);
  text-align: center;
  letter-spacing: 0.06em;
  margin-top: -8px;
}

.adm-login-sub--dim {
  color: var(--adm-text-muted);
  font-size: 10px;
  margin-top: -4px;
}

/* ── Input ── */
.adm-field-wrap {
  position: relative;
  width: 100%;
}

.adm-field-wrap--pw { display: flex; align-items: center; }

.adm-input {
  width: 100%;
  background: var(--adm-card);
  border: 1.5px solid var(--adm-border-dim);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--adm-text);
  font-family: var(--adm-sans);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.adm-input:focus {
  border-color: var(--adm-gold);
  box-shadow: 0 0 0 3px var(--adm-gold-dim);
}

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

.adm-pw-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--adm-text-sub);
  padding: 4px;
  line-height: 1;
}

/* ── Buttons ── */
.adm-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: var(--adm-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.adm-btn--gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #000;
  box-shadow: 0 4px 20px rgba(255,215,0,0.3);
}

.adm-btn--gold:hover { box-shadow: 0 6px 28px rgba(255,215,0,0.45); transform: translateY(-1px); }
.adm-btn--gold:active { transform: translateY(0); box-shadow: 0 2px 10px rgba(255,215,0,0.3); }

.adm-btn--gold:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.adm-btn--outline {
  background: transparent;
  border: 1.5px solid var(--adm-gold);
  color: var(--adm-gold);
  font-family: var(--adm-display);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.adm-btn--outline:hover { background: var(--adm-gold-dim); }

.adm-btn--danger {
  background: linear-gradient(135deg, #FF4455 0%, #CC0022 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255,68,85,0.25);
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: var(--adm-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.adm-btn--danger:hover { box-shadow: 0 6px 28px rgba(255,68,85,0.4); transform: translateY(-1px); }
.adm-btn--danger:active { transform: translateY(0); }

.adm-btn--danger:disabled, .adm-btn--gold:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
}

/* ── Messages ── */
.adm-msg {
  font-family: var(--adm-mono);
  font-size: 12px;
  text-align: center;
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 4px;
}

.adm-msg--error {
  background: var(--adm-red-dim);
  color: var(--adm-red);
  border: 1px solid rgba(255,68,85,0.2);
}

.adm-msg--success {
  background: var(--adm-green-dim);
  color: var(--adm-green);
  border: 1px solid rgba(0,200,150,0.2);
}

/* ══════════════════════════════════════════
   SHARED: HEADER
══════════════════════════════════════════ */
.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--sat) + 12px) 16px 12px;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-border);
  min-height: calc(var(--adm-header-h) + var(--sat));
  flex-shrink: 0;
  gap: 12px;
}

.adm-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-header-crown { font-size: 24px; }

.adm-header-title {
  font-family: var(--adm-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--adm-gold);
}

.adm-header-sub {
  font-family: var(--adm-mono);
  font-size: 10px;
  color: var(--adm-text-muted);
  margin-top: 2px;
}

.adm-back-btn {
  background: var(--adm-card);
  border: 1px solid var(--adm-border-dim);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--adm-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.adm-back-btn:hover { border-color: var(--adm-gold); color: var(--adm-gold); }

.adm-logout-btn {
  background: transparent;
  border: 1px solid rgba(255,68,85,0.3);
  border-radius: 10px;
  padding: 6px 12px;
  color: var(--adm-red);
  font-family: var(--adm-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.adm-logout-btn:hover { background: var(--adm-red-dim); }

/* ══════════════════════════════════════════
   SHARED: CONTENT AREA
══════════════════════════════════════════ */
.adm-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--adm-nav-h) + var(--sab) + 16px);
  -webkit-overflow-scrolling: touch;
}

.adm-content--list {
  padding: 8px 16px;
  padding-bottom: calc(var(--adm-nav-h) + var(--sab) + 8px);
}

.adm-section-title {
  font-family: var(--adm-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--adm-text);
  margin-bottom: 4px;
}

.adm-sync-label {
  font-family: var(--adm-mono);
  font-size: 10px;
  color: var(--adm-text-muted);
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   PAGE 2: DASHBOARD STATS
══════════════════════════════════════════ */
.adm-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.adm-stat-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border-dim);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  transition: border-color 0.2s;
}

.adm-stat-card:hover { border-color: var(--adm-border); }

.adm-stat-card--gold { border-color: rgba(255,215,0,0.2); background: linear-gradient(160deg, #1a1800 0%, #181818 100%); }
.adm-stat-card--green { border-color: rgba(0,200,150,0.2); background: linear-gradient(160deg, #001a14 0%, #181818 100%); }

.adm-stat-icon { font-size: 22px; margin-bottom: 6px; }

.adm-stat-val {
  font-family: var(--adm-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--adm-text);
  margin-bottom: 4px;
  line-height: 1;
}

.adm-stat-card--gold .adm-stat-val { color: var(--adm-gold); }
.adm-stat-card--green .adm-stat-val { color: var(--adm-green); }

.adm-stat-label {
  font-family: var(--adm-mono);
  font-size: 9px;
  color: var(--adm-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════
   PAGE 3: SEARCH + USER LIST
══════════════════════════════════════════ */
.adm-user-count-badge {
  background: var(--adm-gold-dim);
  border: 1px solid var(--adm-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--adm-mono);
  font-size: 12px;
  color: var(--adm-gold);
  white-space: nowrap;
  flex-shrink: 0;
}

.adm-search-wrap {
  padding: 12px 16px 8px;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-border-dim);
  flex-shrink: 0;
}

.adm-search-input {
  width: 100%;
  background: var(--adm-card);
  border: 1.5px solid var(--adm-border-dim);
  border-radius: 14px;
  padding: 14px 18px;
  color: var(--adm-text);
  font-family: var(--adm-sans);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.adm-search-input:focus {
  border-color: var(--adm-gold);
  box-shadow: 0 0 0 3px var(--adm-gold-dim);
}

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

/* User Card in List */
.adm-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--adm-card);
  border: 1px solid var(--adm-border-dim);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.adm-user-card:hover, .adm-user-card:active {
  border-color: var(--adm-gold);
  background: var(--adm-card-hover);
  transform: translateX(2px);
}

.adm-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #333 0%, #222 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--adm-gold);
  font-family: var(--adm-display);
  flex-shrink: 0;
  border: 1.5px solid var(--adm-border-dim);
  overflow: hidden;
}

.adm-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.adm-user-info { flex: 1; min-width: 0; }

.adm-user-name {
  font-family: var(--adm-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--adm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-user-email {
  font-family: var(--adm-mono);
  font-size: 11px;
  color: var(--adm-text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.adm-user-uid {
  font-family: var(--adm-mono);
  font-size: 9px;
  color: var(--adm-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-role-chip {
  font-family: var(--adm-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.adm-role-chip--founder {
  background: linear-gradient(135deg, rgba(255,215,0,0.2) 0%, rgba(255,165,0,0.15) 100%);
  color: var(--adm-gold);
  border: 1px solid rgba(255,215,0,0.3);
}

.adm-role-chip--member {
  background: rgba(255,255,255,0.05);
  color: var(--adm-text-muted);
  border: 1px solid var(--adm-border-dim);
}

.adm-user-arrow {
  color: var(--adm-text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

/* Empty / Loading states */
.adm-loading {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--adm-mono);
  font-size: 13px;
  color: var(--adm-text-muted);
}

.adm-empty {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--adm-mono);
  font-size: 13px;
  color: var(--adm-text-muted);
}

/* ══════════════════════════════════════════
   PAGE 4: ROLE MANAGER
══════════════════════════════════════════ */
.adm-profile-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 18px;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
}

.adm-profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2a00 0%, #1a1a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--adm-gold);
  font-family: var(--adm-display);
  flex-shrink: 0;
  border: 2px solid var(--adm-border);
  overflow: hidden;
}

.adm-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.adm-profile-info { flex: 1; min-width: 0; }

.adm-profile-name {
  font-family: var(--adm-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--adm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-profile-email {
  font-family: var(--adm-mono);
  font-size: 11px;
  color: var(--adm-text-sub);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-profile-uid {
  font-family: var(--adm-mono);
  font-size: 9px;
  color: var(--adm-text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-role-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--adm-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.adm-role-badge--founder {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #000;
}

.adm-role-badge--member {
  background: rgba(255,255,255,0.08);
  color: var(--adm-text-sub);
  border: 1px solid var(--adm-border-dim);
}

/* Detail Table */
.adm-detail-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border-dim);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}

.adm-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--adm-border-dim);
}

.adm-detail-row:last-child { border-bottom: none; }

.adm-detail-label {
  font-family: var(--adm-mono);
  font-size: 11px;
  color: var(--adm-text-muted);
}

.adm-detail-val {
  font-family: var(--adm-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--adm-text);
  text-align: right;
}

.adm-detail-val--gold { color: var(--adm-gold); }
.adm-detail-val--green { color: var(--adm-green); }

/* Action Area */
.adm-action-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.adm-btn--upgrade {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #000;
  box-shadow: 0 4px 24px rgba(255,215,0,0.35);
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-family: var(--adm-display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.adm-btn--upgrade:hover { box-shadow: 0 6px 32px rgba(255,215,0,0.5); transform: translateY(-2px); }
.adm-btn--upgrade:active { transform: translateY(0); }
.adm-btn--upgrade:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.adm-btn--reset {
  background: transparent;
  border: 1.5px solid rgba(255,68,85,0.4);
  color: var(--adm-red);
  width: 100%;
  border-radius: 14px;
  padding: 14px;
  font-family: var(--adm-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.adm-btn--reset:hover { background: var(--adm-red-dim); border-color: var(--adm-red); }
.adm-btn--reset:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════
   BOTTOM NAVIGATION
══════════════════════════════════════════ */
.adm-bottom-nav {
  display: flex;
  background: var(--adm-surface);
  border-top: 1px solid var(--adm-border);
  padding-bottom: var(--sab);
  height: calc(var(--adm-nav-h) + var(--sab));
  flex-shrink: 0;
}

.adm-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--adm-text-muted);
  font-family: var(--adm-mono);
  font-size: 10px;
  transition: color 0.15s;
  padding: 8px 4px;
  -webkit-tap-highlight-color: transparent;
}

.adm-nav-btn span:first-child { font-size: 20px; }

.adm-nav-btn--active { color: var(--adm-gold); }

.adm-nav-btn:hover { color: var(--adm-gold); }

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
.adm-toast {
  position: fixed;
  bottom: calc(var(--adm-nav-h) + var(--sab) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  padding: 12px 20px;
  font-family: var(--adm-mono);
  font-size: 13px;
  color: var(--adm-text);
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.adm-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--adm-border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,215,0,0.3); }
