:root {
  --bg: #0e0e10;
  --panel: #1a1a1d;
  --panel-2: #232326;
  --border: #2e2e32;
  --text: #f2f2f3;
  --text-dim: #9a9aa1;
  --accent: #ff0048;
  --accent-dim: rgba(255, 0, 72, 0.15);
  --green: #2ecc71;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
}

.brand {
  padding: 24px 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}
.brand span { color: var(--accent); }

.sidebar nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-dim);
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--panel-2); }
.nav-item.active {
  color: var(--text);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-user { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.logout-link { font-size: 13px; color: var(--accent); }

.content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }

/* Mobile header (hamburger) -- hidden on desktop, the sidebar is always visible there. */
.mobile-header {
  display: none;
  /* .shell is a row flex container (sidebar + content side by side). A width:100%
     sticky item dropped into that same row still counts as a flex item demanding 100%
     of the row's width, leaving .content (flex:1, min-width:0) squeezed to 0 and pushed
     off-screen to the right. Fixed positioning -- same trick already used for .sidebar
     and .sidebar-backdrop -- takes it out of the flex flow entirely instead. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.mobile-header .brand { padding: 0; }
.hamburger {
  background: none;
  border: none;
  color: var(--text);
  padding: 4px;
  cursor: pointer;
  display: flex;
}
.hamburger svg { width: 24px; height: 24px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 45;
}

@media (max-width: 780px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  /* mobile-header is position:fixed (out of flow, see its own rule above), so .content
     needs its own top offset to not render underneath it -- 56px covers the header's
     actual rendered height (~53px) with a little slack. */
  .content { margin-left: 0; padding-top: 56px; }
}

.content-header {
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
}
.content-header h1 { margin: 0; font-size: 20px; font-weight: 600; }

.content-body { padding: 28px 32px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-card-link { display: block; cursor: pointer; }
.stat-card-link:hover { border-color: var(--accent); }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.stat-card.accent .value { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-title {
  padding: 14px 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--panel-2); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}
.badge.red { background: var(--accent-dim); color: var(--accent); }
.badge.green { background: rgba(46,204,113,0.15); color: var(--green); }
.badge.grey { background: var(--panel-2); color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--text-dim); }
.btn.danger { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.btn.danger:hover { background: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { opacity: 0.9; }

.empty { padding: 32px 18px; text-align: center; color: var(--text-dim); }

.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form input[type=text] {
  flex: 1;
  max-width: 320px;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
}
.search-form input[type=text]:focus { outline: none; border-color: var(--accent); }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  padding: 8px 16px;
  border-radius: 7px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
}
.tab.active { background: var(--accent-dim); color: var(--accent); }

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13.5px;
}
.flash.error { background: rgba(255,0,72,0.12); color: #ff5c82; border: 1px solid rgba(255,0,72,0.3); }
.flash.success { background: rgba(46,204,113,0.12); color: var(--green); border: 1px solid rgba(46,204,113,0.3); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}
.login-card .brand { padding: 0 0 24px; text-align: center; }
.login-card label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
/* Scoped to the submit button specifically -- "button" alone also matched the
   password-visibility eye toggle nested inside .password-wrap, stretching it full-width
   and painting it red like a second submit button (see project notes). */
.login-card .login-submit {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  border-radius: 7px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.login-card .login-submit:hover { opacity: 0.9; }
.login-forgot {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
}
.login-forgot:hover { color: var(--accent); }

/* Photo moderation popup (user.php) -- click a thumbnail, Accepter/Refuser. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
  /* A tall (portrait) photo would otherwise stretch this past the viewport and push
     Accepter/Refuser off-screen -- capped + scrollable as a fallback on very small
     screens, but the image itself is what actually shrinks to fit (see .modal-photo). */
  max-height: 90vh;
  overflow-y: auto;
}
.modal-photo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 65vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 8px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions form { flex: 1; }
.modal-actions .btn { width: 100%; }
.thumb-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: block;
}

.muted { color: var(--text-dim); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* Password field with a show/hide eye toggle -- wraps any <input type=password>, works
   for both login.php's single field and account.php's three (current/new/confirm). */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px !important; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
}
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle .icon-off { display: none; }
.password-toggle.showing .icon-on { display: none; }
.password-toggle.showing .icon-off { display: block; }
