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

:root {
  --bg: #f8f9fc;
  --panel: #ffffff;
  --text: #000000;
  --muted: #495057;
  --line: #000000;
  --primary: #3b82f6;
  --secondary: #eab308;
  --danger: #ef4444;
  --success: #22c55e;
  --accent: #8b5cf6;
  
  --border-width: 3px;
  --shadow-color: #000000;
  --shadow-offset: 5px;
  --border-radius: 8px;
  /* --transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); */
  --transition: all 0.2s ease-in-out;
}

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  margin: 0;
  font-weight: 500;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(#000000 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0;
  pointer-events: none;
  z-index: -1;
}

code { font-family: "SFMono-Regular", Consolas, monospace; font-weight: 600; }
a { color: inherit; text-decoration: none; }

/* Layouts */
.shell {
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  background: #fdfdfd;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: var(--border-width) solid var(--line);
  z-index: 10;
}

.brand h1, .page-head h2, .auth-hero h2, .section-head h3 {
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.brand h1 { font-size: 2rem; color: var(--text); }
.brand p, .profile-email { color: var(--muted); font-size: 0.9rem; }
.brand-kicker, .eyebrow {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--primary);
  background: #e0e7ff;
  display: inline-block;
  padding: 4px 8px;
  border: 2px solid var(--line);
  border-radius: 4px;
  margin-bottom: 8px;
}

.nav { display: grid; gap: 12px; }
.nav a {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  background: var(--panel);
  border: 2px solid var(--line);
  font-weight: 600;
  box-shadow: 3px 3px 0px var(--shadow-color);
  transition: var(--transition);
}
.nav a:hover, .nav a:focus {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px var(--shadow-color);
  background: #f1f5f9;
}
.nav a.is-active {
  background: var(--primary);
  color: #fff;
}
.nav a.is-active:hover,
.nav a.is-active:focus {
  background: var(--primary);
  color: #fff;
}
.nav a:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px var(--shadow-color);
}

.profile-card {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--border-radius);
  background: var(--secondary);
  border: var(--border-width) solid var(--line);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
}

.profile-name { font-weight: 700; margin-top: 6px; font-size: 1.1em; }
.profile-label { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: #000; }

.main {
  margin-left: 280px;
  padding: 40px;
  overflow-x: hidden;
}
.main-auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  margin-left: auto;
  padding: 40px 20px;
}
.main-auth .auth-card {
  margin: auto;
}

/* Page Head */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 30px;
  background: var(--panel);
  padding: 24px;
  border: var(--border-width) solid var(--line);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
}
.page-head.split { align-items: center; }
.page-head p { margin: 0; color: var(--muted); }

/* Neo Brutalism Components */
.auth-card, .form-card, .table-card {
  background: var(--panel);
  border: var(--border-width) solid var(--line);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
  margin-bottom: 30px;
}

.auth-card {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden; /* Prevent spill but will allow scrolling via flex */
  /* Remove fixed min-height bug */
}

/* Auth Section enhancements */
.auth-hero {
  padding: 40px;
  background: var(--primary);
  color: white;
  border-right: var(--border-width) solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-hero h2 { color: white; }
.auth-hero p { color: rgba(255,255,255,0.9); font-weight: 500; }
.auth-card form { padding: 40px; background: var(--panel); }

.stack { display: grid; gap: 20px; }
.form-grid { display: grid; gap: 20px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input, select, textarea, .form-control, .form-select {
  width: 100%;
  border: 2px solid var(--line) !important;
  background: #fff !important;
  border-radius: 6px !important;
  padding: 12px 14px;
  font-family: inherit;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: 2px 2px 0px rgba(0,0,0,0.2) !important;
}
input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 4px 4px 0px var(--primary) !important;
  transform: translateY(-2px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 12px 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 4px 4px 0px var(--shadow-color);
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  font-size: 1rem;
}
.button:hover, .button:focus {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--shadow-color);
  outline: none;
}
.button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0px var(--shadow-color);
}

.button-primary { background: var(--primary); color: #fff; }
.button-secondary { background: var(--secondary); color: var(--text); }
.button-danger { background: var(--danger); color: #fff; }
.button-ghost { background: #f1f5f9; color: var(--text); }
.button-small { padding: 6px 12px; font-size: 0.85rem; }

.inline-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.toolbar { display: flex; gap: 12px; margin-bottom: 24px; }
.toolbar-grid { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto; }
.pagination-bar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.pagination-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button.disabled { opacity: 0.55; pointer-events: none; }

/* Dashboard Stats */
.stats-grid, .action-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 30px;
}

.stat-card, .action-card {
  background: var(--panel);
  border: var(--border-width) solid var(--line);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--shadow-color);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: calc(var(--shadow-offset) + 0px) calc(var(--shadow-offset) + 4px) 0px var(--shadow-color);
  background: #fbbf24;
}
.action-card:hover {
  transform: translateY(-4px);
  box-shadow: calc(var(--shadow-offset) + 2px) calc(var(--shadow-offset) + 2px) 0px var(--shadow-color);
  background: #60a5fa;
  color: #000;
}

.stat-card span { font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; border-bottom: 2px solid #000; padding-bottom: 4px; display: inline-block; margin-bottom: 12px;}
.stat-card strong { display: block; margin: 8px 0; font-size: 2.5rem; font-weight: 800; }
.stat-card small, .action-card p { color: var(--muted); font-weight: 600;}

/* Tables */
.table-card { overflow-x: auto; }
.table-card table, .register-table { width: 100%; border-collapse: collapse; }
.table-card th, .table-card td, .register-table th, .register-table td {
  padding: 16px;
  border-bottom: 2px solid var(--line);
  vertical-align: middle;
  text-align: left;
}
.table-card th, .register-table th {
  font-weight: 700;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: var(--border-width) solid var(--line);
}
.table-card tbody tr { transition: background 0.1s; }
.table-card tbody tr:hover { background: #fef08a; }

.actions { white-space: nowrap; gap: 8px; }
.muted { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-top: 4px; }

/* Banners */
.banner {
  padding: 16px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  font-weight: 700;
  border: var(--border-width) solid var(--line);
  box-shadow: 4px 4px 0px var(--shadow-color);
}
.banner.success { background: var(--success); color: #fff; }
.banner.danger { background: var(--danger); color: #fff; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: #e2e8f0;
  border-bottom: var(--border-width) solid var(--line);
}
.section-head.tight { margin-top: 24px; border: var(--border-width) solid var(--line); border-radius: var(--border-radius) var(--border-radius) 0 0; margin-bottom: 0; }
.section-head h3 { margin: 0; font-weight: 700; }
.register-table-wrap { 
  overflow-x: auto; 
  /* border: var(--border-width) solid var(--line);  */
  border-top: none; 
  /* border-radius: 0 0 var(--border-radius) var(--border-radius);  */
  background: var(--panel); 
}

.live-summary-grid .stat-card strong {
  font-size: 1.8rem;
}

.live-topics-grid .action-card h3 {
  margin-bottom: 10px;
}

.live-topics-grid code {
  word-break: break-all;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.live-panel-wide {
  grid-column: 1 / -1;
}

.live-panel-body {
  padding: 20px;
}

.live-panel pre {
  margin: 12px 0 0;
  padding: 16px;
  background: #f8fafc;
  border: 2px solid var(--line);
  border-radius: 6px;
  min-height: 180px;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.2);
}

.live-log-wrap {
  overflow-x: auto;
}

.empty {
  text-align: center;
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: var(--border-width) solid var(--line);
  }
  .main { margin-left: 0; padding: 24px; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-hero { border-right: none; border-bottom: var(--border-width) solid var(--line); padding: 30px; }
}

@media (max-width: 720px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head.split { align-items: stretch; }
  .toolbar-grid { grid-template-columns: 1fr; }
  .pagination-bar { align-items: flex-start; }
  .pagination-controls { width: 100%; }
  .form-grid.two { grid-template-columns: 1fr; }
  .live-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}

/* Modals Neo Brutalism */
.modal-content {
  background-color: var(--panel);
  border: var(--border-width) solid var(--line);
  border-radius: var(--border-radius);
  box-shadow: 12px 12px 0px var(--shadow-color);
  border-radius: 0;
}
.modal-header {
  border-bottom: var(--border-width) solid var(--line);
  background-color: var(--secondary);
  padding: 16px 24px;
  border-radius: 0;
}
.modal-title {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: #000;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  border-top: var(--border-width) solid var(--line);
  background-color: #f1f5f9;
  padding: 16px 24px;
  border-radius: 0;
}

/* Custom Close Button in Modal */
.btn-close {
  background-color: #fff;
  border: 2px solid var(--line);
  opacity: 1;
  box-shadow: 3px 3px 0px var(--shadow-color);
  transition: var(--transition);
  border-radius: 4px;
  padding: 12px;
}
.btn-close:hover, .btn-close:focus {
  background-color: var(--danger);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px var(--shadow-color);
  opacity: 1;
  outline: none;
}
.btn-close:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px var(--shadow-color);
}
