@charset "UTF-8";
/* ============================================================
   POKER CONTROL -- Industrial Terminal Aesthetic
   Monospace grid, felt green accents, crisp data tables
   ============================================================ */

:root {
  --bg-base:      #0d0f0e;
  --bg-surface:   #131614;
  --bg-raised:    #1a1d1b;
  --bg-hover:     #1f2420;
  --border:       #2a2e2b;
  --border-light: #333836;

  --green:        #4ade80;
  --green-dim:    #22c55e;
  --green-muted:  #166534;
  --red:          #f87171;
  --red-dim:      #dc2626;
  --yellow:       #fbbf24;
  --blue:         #60a5fa;

  --text-primary:   #e8ede9;
  --text-secondary: #8a9e8c;
  --text-muted:     #4f6151;
  --text-accent:    #4ade80;

  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;

  --sidebar-w: 200px;
  --radius: 3px;
  --radius-lg: 6px;
}

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}

/* -- Scrollbar -- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-chip {
  font-size: 24px;
  color: var(--green);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-links li { margin: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--green);
  border-left-color: var(--green);
  background: var(--bg-hover);
}

.nav-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 28px 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* -- Page header -- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--green-muted);
}

.stat-card.positive::before { background: var(--green); }
.stat-card.negative::before { background: var(--red); }
.stat-card.warning::before  { background: var(--yellow); }
.stat-card.info::before     { background: var(--blue); }

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

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }
.stat-value.yellow{ color: var(--yellow); }

/* ============================================================
   SECTIONS / PANELS
   ============================================================ */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.panel-body { padding: 20px; }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tr:hover td { background: var(--bg-hover); }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table .positive { color: var(--green); }
.data-table .negative { color: var(--red); }
.data-table .muted    { color: var(--text-muted); }

/* -- Row actions -- */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; opacity: 0; transition: opacity 0.15s; }
tr:hover .row-actions { opacity: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green-muted);
  border-color: var(--green-dim);
  color: var(--green);
}
.btn-primary:hover {
  background: var(--green-dim);
  color: var(--bg-base);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  border-color: var(--red-dim);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red-dim);
  color: white;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding: 4px 8px;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-sm { padding: 4px 9px; font-size: 10px; }
.btn-xs { padding: 2px 7px; font-size: 10px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.08);
}

.form-select { cursor: pointer; }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}

.form-check-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 2px;
  border: 1px solid;
}

.badge-green  { color: var(--green); border-color: var(--green-muted); background: rgba(74,222,128,0.08); }
.badge-red    { color: var(--red);   border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }
.badge-yellow { color: var(--yellow); border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.08); }
.badge-blue   { color: var(--blue);  border-color: rgba(96,165,250,0.4); background: rgba(96,165,250,0.08); }
.badge-muted  { color: var(--text-muted); border-color: var(--border); background: transparent; }
.badge-orange { color: #f97316; border-color: rgba(249,115,22,0.4); background: rgba(249,115,22,0.08); }
.badge-purple { color: #a78bfa; border-color: rgba(167,139,250,0.4); background: rgba(167,139,250,0.08); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  color: var(--text-accent);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  animation: toast-in 0.2s ease;
  max-width: 320px;
}
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }

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

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--green-dim); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.empty-state .empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }

/* ============================================================
   TWO COLUMN LAYOUT
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============================================================
   MISC
   ============================================================ */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.text-right  { text-align: right; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

a { color: var(--green-dim); text-decoration: none; }
a:hover { color: var(--green); text-decoration: underline; }

.link-plain { color: inherit; }
.link-plain:hover { color: var(--green); text-decoration: none; }

/* chips for session type */
.chip-tournament { color: var(--blue); }
.chip-grind      { color: var(--yellow); }

/* Tier builder */
.tier-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.tier-row .form-label { font-size: 9px; }

/* Summary bar below player detail */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.summary-item {
  background: var(--bg-surface);
  padding: 16px 20px;
  text-align: center;
}

.summary-item .label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.summary-item .value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

/* -- Organization selector ------------------------------------------------ */
.sidebar-org {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}
.org-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-switch {
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color .15s;
  flex-shrink: 0;
  margin-left: 8px;
}
.org-switch:hover { color: var(--text-primary); }

.user-role {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: 6px;
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ============================================================
   MOBILE RESPONSIVE  (breakpoint: 768px)
   ============================================================ */

/* ── Hamburger button (mobile only) ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 300;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--green);
  font-size: 18px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

/* ── Overlay behind open sidebar ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

@media (max-width: 768px) {
  /* ── Sidebar: hidden off-screen, slides in ── */
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    width: 220px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  /* ── Main content: full width ── */
  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 56px 14px 20px; /* top pad for hamburger */
  }

  /* ── Page header: stack vertically ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-header > div:last-child {
    width: 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  /* ── Stat grid: 2 columns on mobile ── */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* ── Summary bar: 2 cols ── */
  .summary-bar {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── Two-col: single column ── */
  .two-col {
    grid-template-columns: 1fr !important;
  }

  /* ── Form rows: single column ── */
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* ── Filters bar: wrap ── */
  .filters-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-select {
    min-width: 140px;
    flex: 1;
  }

  /* ── Data table: horizontal scroll ── */
  .panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 540px;
  }

  /* ── Modal: full-screen on mobile ── */
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    position: fixed !important;
    inset: 0 !important;
    overflow-y: auto;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  /* ── Form actions: stack buttons ── */
  .form-actions {
    flex-wrap: wrap;
  }

  /* ── Stat card values: smaller font ── */
  .stat-value {
    font-size: 18px !important;
  }

  /* ── Row actions: wrap ── */
  .row-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* ── Panel header: wrap ── */
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Analytics: 3-col grids go single col ── */
  [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  /* ── Very small screens ── */
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .summary-bar {
    grid-template-columns: 1fr !important;
  }

  .main-content {
    padding: 52px 10px 16px;
  }
}
