/* Base */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}
.login-card h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
}
.login-card .subtitle {
  color: #94a3b8;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.login-card label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  color: #cbd5e1;
}
.login-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.login-card input:focus {
  outline: none;
  border-color: #3b82f6;
}
.btn {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  width: 100%;
  margin-bottom: 0.5rem;
}
.btn-primary {
  background: #3b82f6;
  color: white;
}
.btn-primary:hover:not(:disabled) { background: #2563eb; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: #94a3b8;
}
.btn-ghost:hover { color: #e2e8f0; }
.message {
  margin-top: 1rem;
  font-size: 0.875rem;
}
.message.error { color: #f87171; }
.message.success { color: #4ade80; }
.hidden { display: none !important; }

/* Dashboard */
.dashboard-page {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-header h1 { margin: 0; font-size: 1.5rem; }
.dashboard-header .user {
  color: #94a3b8;
  font-size: 0.875rem;
}
.dashboard-header .btn-logout {
  padding: 0.5rem 1rem;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}
.dashboard-header .btn-logout:hover { background: #475569; }

/* Section tabs */
.section-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #334155;
  flex-wrap: wrap;
}
.section-tabs .tab {
  padding: 0.75rem 1.25rem;
  background: transparent;
  color: #94a3b8;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.9375rem;
  margin-bottom: -1px;
}
.section-tabs .tab:hover { color: #e2e8f0; }
.section-tabs .tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}
.dashboard-panel {
  display: none;
}
.dashboard-panel.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid #334155;
}
.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}
.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

.section-title {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: #cbd5e1;
}
.table-wrap {
  overflow-x: auto;
  background: #1e293b;
  border-radius: 12px;
  border: 1px solid #334155;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #334155;
}
th {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.03); }
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}
.badge-user { background: #1e3a5f; color: #93c5fd; }
.badge-creator { background: #1e3a2e; color: #86efac; }
.badge-admin { background: #451a3a; color: #f0abfc; }

.loading, .error-msg {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
}
.error-msg { color: #f87171; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
}
.pagination button {
  padding: 0.5rem 0.75rem;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.pagination button:hover:not(:disabled) { background: #475569; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination span { font-size: 0.875rem; color: #94a3b8; }

.search-input {
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.9375rem;
  margin-right: 0.5rem;
}
.btn-inline {
  width: auto;
  margin-bottom: 0;
}

/* User detail panel */
.user-detail-panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  display: none;
}
.user-detail-panel.visible {
  display: block;
}
.user-detail-panel h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #f8fafc;
}
.user-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.user-detail-item {
  font-size: 0.875rem;
}
.user-detail-item .label {
  color: #94a3b8;
  display: block;
  margin-bottom: 0.25rem;
}
.user-detail-item .value {
  color: #e2e8f0;
}
.user-detail-panel .btn-close {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}
.user-detail-panel .btn-close:hover { background: #475569; }
tr.user-row { cursor: pointer; }
tr.clickable-row { cursor: pointer; }
tr.user-row.selected td,
tr.course-row.selected td,
tr.webinar-row.selected td { background: rgba(59, 130, 246, 0.15); }
.date-fmt { white-space: nowrap; }
