/* Dino Dash Admin — standalone dashboard (no game styles) */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1a2332;
  --surface-3: #243044;
  --border: #2d3a4f;
  --border-light: #374357;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --sidebar-w: 240px;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

.hidden { display: none !important; }

#admin-app {
  min-height: 100vh;
}

/* Views */
.admin-view {
  min-height: 100vh;
}

/* Auth screens */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59, 130, 246, 0.15), transparent),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-logo {
  display: block;
  height: auto;
  flex-shrink: 0;
  background: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.brand-logo-sidebar {
  width: 88px;
  max-width: 100%;
}

.auth-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.auth-brand p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark-warn {
  background: linear-gradient(135deg, var(--warning), var(--danger));
}

/* Dashboard layout */
#admin-dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-brand strong {
  display: block;
  font-size: 14px;
}

.sidebar-brand span {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: #93c5fd;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  margin: 0 5px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.user-pill {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
}

.content {
  padding: 24px 32px 48px;
  flex: 1;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-toolbar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.players-search-bar {
  margin-bottom: 16px;
  max-width: 420px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Cards */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.panel-card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.panel-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-card-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.panel-card-form {
  max-width: 720px;
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  padding: 22px;
}

.span-2 { grid-column: span 2; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.field span em {
  font-style: normal;
  color: var(--text-dim);
  font-weight: 400;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input[type="datetime-local"] {
  color-scheme: dark;
  min-height: 42px;
}

.schedule-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.schedule-block-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.schedule-block-note {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.schedule-fields {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.schedule-preview {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: #93c5fd;
  line-height: 1.45;
}

.alert-error {
  margin: 0 22px 16px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.file-input {
  padding: 8px !important;
  font-size: 13px !important;
}

.password-wrap {
  display: flex;
  gap: 8px;
}

.password-wrap input {
  flex: 1;
}

.pw-toggle {
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.pw-toggle:hover {
  color: var(--text);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-actions {
  padding-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.btn-link-admin {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  width: 100%;
  text-align: center;
  font-family: inherit;
}

.btn-link-admin:hover {
  color: #bfdbfe;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Tables */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrap-inner {
  border: none;
  border-radius: 0;
  background: transparent;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.cell-name {
  font-weight: 600;
  color: var(--text);
}

.cell-name small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-email {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.cell-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
}

.cell-rank {
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.cell-rank.top-1 { color: #fbbf24; }
.cell-rank.top-2 { color: #cbd5e1; }
.cell-rank.top-3 { color: #d97706; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 15px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-live {
  background: var(--success-soft);
  color: #86efac;
}

.status-upcoming {
  background: var(--accent-soft);
  color: #93c5fd;
}

.status-ended {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

/* Detail / standings */
.detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-title-row h3 {
  margin: 0;
  font-size: 20px;
}

.detail-meta {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.detail-countdown {
  margin: 8px 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: #93c5fd;
}

.detail-desc {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.banner-preview {
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 200px;
}

.banner-preview img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.edit-desc-row {
  display: flex;
  gap: 12px;
  padding: 18px 22px;
  align-items: flex-start;
}

.edit-desc-row textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
}

.edit-desc-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
  #admin-dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
  }

  .sidebar-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    flex: 1;
    min-width: 140px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
    gap: 6px;
  }

  .nav-item {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
  }

  .sidebar-footer {
    flex-direction: row;
    border-top: none;
    padding-top: 0;
    order: 2;
  }

  .topbar {
    padding: 16px 20px 12px;
  }

  .content {
    padding: 16px 20px 32px;
  }

  .schedule-fields {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .edit-desc-row {
    flex-direction: column;
  }
}
