/* ============================================================
   Admin Styles — dark editorial, matches landing aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Syne:wght@400;500;600;700&display=swap');

/* ── Design tokens (same as landing) ── */
:root {
  --bg:          #080810;
  --bg-card:     #0f0f1a;
  --bg-card-2:   #141424;
  --border:      rgba(255,255,255,0.08);
  --text:        #e5e5f0;
  --text-muted:  #7070a0;
  --accent:      #7c5cfc;
  --accent-dim:  rgba(124,92,252,0.12);
  --accent-glow: rgba(124,92,252,0.30);
  --green:       #10b981;
  --red:         #f87171;
  --radius-sm:   4px;
  --radius:      12px;
  --font-head:   'Instrument Serif', Georgia, serif;
  --font-body:   'Syne', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Subtle noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Layout container ── */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
}

.login-logo {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: #fff;
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.login-card h1 {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 400;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.alert-error {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--red);
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-form input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  margin-bottom: 18px;
  transition: border-color 0.18s;
}

.login-form input[type="password"]:focus {
  border-color: rgba(124,92,252,0.5);
}

.login-form input[type="password"]::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

/* ============================================================
   SHARED BUTTON STYLES
   ============================================================ */
.btn-primary {
  display: block;
  width: 100%;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.18s, box-shadow 0.18s;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
  background: #6b4de8;
  box-shadow: 0 0 28px var(--accent-glow);
}

/* ============================================================
   ADMIN HEADER
   ============================================================ */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,16,0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-header .admin-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}

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

.admin-logo {
  font-family: var(--font-head);
  font-size: 1.2rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.admin-header-sep {
  color: var(--border);
  font-size: 1rem;
}

.admin-header-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(124,92,252,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s;
}

.btn-export:hover {
  background: rgba(124,92,252,0.2);
  border-color: var(--accent);
}

.logout-form {
  margin: 0;
}

.btn-logout {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s, color 0.18s;
}

.btn-logout:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
  padding: 36px 0 80px;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: rgba(124,92,252,0.2);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 400;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-accent {
  color: var(--accent);
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.18s;
}

.search-input:focus {
  border-color: rgba(124,92,252,0.5);
}

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

.btn-search {
  padding: 9px 16px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s;
}

.btn-search:hover {
  border-color: rgba(255,255,255,0.2);
}

.btn-clear {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 9px 12px;
  transition: color 0.15s;
}

.btn-clear:hover { color: var(--text); }

.sort-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sort-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.sort-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.sort-active {
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

/* ── Table metadata ── */
.table-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Table ── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

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

.signup-table thead {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.signup-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.signup-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.signup-table tbody tr:last-child {
  border-bottom: none;
}

.signup-table tbody tr:hover {
  background: var(--bg-card);
}

.signup-table td {
  padding: 13px 20px;
  vertical-align: middle;
}

.col-num {
  width: 52px;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.col-email {
  /* takes remaining space */
}

.col-date {
  width: 140px;
  white-space: nowrap;
}

.email-val {
  color: var(--text);
  font-size: 0.875rem;
}

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

.rel-time {
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: default;
  border-bottom: 1px dashed rgba(255,255,255,0.12);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 20px;
  opacity: 0.4;
}

.empty-heading {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 400;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.empty-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state .btn-primary {
  width: auto;
  display: inline-block;
  padding: 10px 20px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}

.page-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid rgba(124,92,252,0.3);
  border-radius: var(--radius-sm);
  transition: background 0.18s, border-color 0.18s;
}

.page-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.page-disabled {
  color: var(--text-muted);
  border-color: var(--border);
  pointer-events: none;
  opacity: 0.5;
}

.page-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-card:last-child { grid-column: 1 / -1; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .search-form { width: 100%; }
  .search-wrap { max-width: 100%; }
  .admin-header-right .btn-export span { display: none; }
  .col-num { display: none; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .stats-row .stat-card:last-child { grid-column: auto; }
  .login-card { padding: 28px 20px; }
}
