/* =============================================================================
   LCC Admin Dashboard CSS
   Dark theme — Llandudno Cricket Club
============================================================================= */

:root {
  --bg:         #0F0F0F;
  --surface:    #1A1A1A;
  --surface-2:  #222222;
  --surface-3:  #2A2A2A;
  --border:     rgba(245,240,232,0.07);
  --border-2:   rgba(245,240,232,0.13);
  --text-1:     #F5F0E8;
  --text-2:     rgba(245,240,232,0.55);
  --text-3:     rgba(245,240,232,0.28);
  --red:        #BE1E2D;
  --red-dim:    rgba(190,30,45,0.15);
  --teal:       #8BB8BE;
  --teal-dim:   rgba(139,184,190,0.12);
  --stone:      #B5A898;
  --green:      #4CAF50;
  --green-dim:  rgba(76,175,80,0.15);
  --amber:      #EF9F27;
  --amber-dim:  rgba(239,159,39,0.15);
  --sidebar-w:  240px;
  --header-h:   56px;
  --radius:     6px;
  --font-ui:    'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Mono', monospace;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =============================================================================
   LAYOUT SHELL
============================================================================= */

.admin-body {
  min-height: 100vh;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.25s ease;
}

/* =============================================================================
   SIDEBAR
============================================================================= */

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.25s ease;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-1);
  flex-shrink: 0;
}

.admin-sidebar__brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

/* Nav */
.admin-nav {
  padding: 12px 0;
  flex: 1;
}

.admin-nav__group {
  margin-bottom: 8px;
}

.admin-nav__group-label {
  display: block;
  padding: 6px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}

.admin-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.admin-nav__item:hover {
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
}

.admin-nav__item.active {
  color: var(--text-1);
  background: var(--surface-2);
  border-left-color: var(--red);
}

.admin-nav__item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.admin-nav__item.active svg,
.admin-nav__item:hover svg {
  opacity: 1;
}

/* Overlay for mobile */
.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 190;
}

/* =============================================================================
   HEADER
============================================================================= */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-header__burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.admin-header__burger:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.admin-header__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  flex: 1;
}

.admin-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-header__user {
  font-size: 13px;
  color: var(--text-2);
}

.admin-header__logout {
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}

.admin-header__logout:hover {
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
}

/* =============================================================================
   MAIN CONTENT
============================================================================= */

.admin-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

.admin-page {
  max-width: 1400px;
  margin: 0 auto;
}

/* =============================================================================
   PAGE HEADER
============================================================================= */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.page-header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.page-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* =============================================================================
   STAT CARDS
============================================================================= */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card--green  { border-top: 3px solid var(--green);  background: var(--surface); }
.stat-card--red    { border-top: 3px solid var(--red);    background: var(--surface); }
.stat-card--amber  { border-top: 3px solid var(--amber);  background: var(--surface); }
.stat-card--teal   { border-top: 3px solid var(--teal);   background: var(--surface); }

.stat-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
}

.stat-card__value--sm {
  font-size: 18px;
  font-weight: 600;
}

.stat-card__value .stat-card__sub,
.stat-card__sub {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
  display: block;
  margin-top: 4px;
}

/* =============================================================================
   CARDS
============================================================================= */

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 20px;
  overflow: hidden;
}

.admin-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.admin-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.admin-card__link {
  color: var(--text-3);
  font-size: 12px;
  text-decoration: none;
}

.admin-card__link:hover {
  color: var(--teal);
}

.admin-card__badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 20px;
}

/* =============================================================================
   FLASH MESSAGES
============================================================================= */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
}

.flash--success {
  background: var(--green-dim);
  border-color: rgba(76,175,80,0.3);
  color: #81c784;
}

.flash--error {
  background: var(--red-dim);
  border-color: rgba(190,30,45,0.3);
  color: #ef9a9a;
}

.flash--warning {
  background: var(--amber-dim);
  border-color: rgba(239,159,39,0.3);
  color: var(--amber);
}

.flash--info {
  background: var(--teal-dim);
  border-color: rgba(139,184,190,0.3);
  color: var(--teal);
}

/* =============================================================================
   TABLES
============================================================================= */

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

.table-meta {
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 0;
  margin-bottom: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

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

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

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

.admin-table tbody tr:hover td {
  background: var(--surface-2);
}

.admin-table--sm td,
.admin-table--sm th {
  padding: 7px 10px;
}

.admin-table tfoot td {
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
  border-top: 1px solid var(--border);
}

.table-group-row td {
  background: var(--surface-3) !important;
  padding: 6px 12px;
}

.table-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.table-name-link {
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
}

.table-name-link:hover {
  color: var(--teal);
  text-decoration: underline;
}

.table-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.table-action {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}

.table-action:hover {
  background: var(--surface-3);
  color: var(--text-1);
  text-decoration: none;
}

.empty-state {
  text-align: center;
  color: var(--text-3);
  padding: 32px;
  font-size: 13px;
}

/* =============================================================================
   BADGES
============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Payment statuses */
.badge-paid      { background: var(--green-dim);  color: #81c784; }
.badge-unpaid    { background: var(--red-dim);    color: #ef9a9a; }
.badge-overdue   { background: var(--red-dim);    color: var(--red); border: 1px solid rgba(190,30,45,0.3); }
.badge-honorary  { background: var(--teal-dim);   color: var(--teal); }

/* Membership statuses */
.badge-status-active    { background: var(--green-dim);  color: #81c784; }
.badge-status-expired   { background: var(--amber-dim);  color: var(--amber); }
.badge-status-cancelled { background: var(--surface-3);  color: var(--text-3); }
.badge-status-suspended { background: var(--red-dim);    color: #ef9a9a; }

/* Member types */
.badge-type        { background: var(--surface-3); color: var(--text-2); }
.badge-type--adult { background: var(--teal-dim);  color: var(--teal); }
.badge-type--child { background: var(--amber-dim); color: var(--amber); }

/* Match statuses */
.badge-match-scheduled  { background: var(--teal-dim);   color: var(--teal); }
.badge-match-completed  { background: var(--green-dim);  color: #81c784; }
.badge-match-cancelled  { background: var(--surface-3);  color: var(--text-3); }
.badge-match-postponed  { background: var(--amber-dim);  color: var(--amber); }
.badge-match-abandoned  { background: var(--surface-3);  color: var(--text-3); }

/* Results */
.badge-result-win  { background: var(--green-dim); color: #81c784; }
.badge-result-loss { background: var(--red-dim);   color: #ef9a9a; }
.badge-result-draw { background: var(--teal-dim);  color: var(--teal); }

/* Page status */
.badge-page-listed   { background: var(--green-dim); color: #81c784; }
.badge-page-unlisted { background: var(--amber-dim); color: var(--amber); }
.badge-page-draft    { background: var(--surface-3); color: var(--text-3); }

/* Squad */
.badge-squad {
  background: var(--surface-3);
  color: var(--stone);
  font-size: 11px;
}

/* Role badge in header */
.badge-role {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--stone);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Availability */
.badge-avail-available   { background: var(--green-dim); color: #81c784; }
.badge-avail-unavailable { background: var(--red-dim);   color: #ef9a9a; }
.badge-avail-maybe       { background: var(--amber-dim); color: var(--amber); }
.badge-avail-unknown     { background: var(--surface-3); color: var(--text-3); }

/* =============================================================================
   FORMS
============================================================================= */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-group--checkbox {
  justify-content: flex-end;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label.required::after {
  content: ' *';
  color: var(--red);
}

.field-type-hint {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
}

.form-input {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(139,184,190,0.15);
}

.form-input::placeholder {
  color: var(--text-3);
}

.form-select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 9px 32px 9px 12px;
  width: 100%;
  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 24 24' fill='none' stroke='rgba(245,240,232,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}

.form-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(139,184,190,0.15);
}

.form-select--sm,
.form-input--sm {
  font-size: 13px;
  padding: 5px 8px;
}

.form-select--sm {
  padding-right: 24px;
  background-position: right 8px center;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-ui);
}

.form-textarea--tall {
  min-height: 200px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-2);
}

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

.form-help {
  font-size: 12px;
  color: var(--text-3);
  margin-top: -2px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  gap: 0 20px;
}

.form-grid--1 { grid-template-columns: 1fr; }
.form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--4 { grid-template-columns: repeat(4, 1fr); }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  margin: 0 -20px -20px;
}

.form-section {
  padding: 20px;
}

.form-section .admin-card__header {
  margin: -20px -20px 20px;
}

/* =============================================================================
   BUTTONS
============================================================================= */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #a51925;
  text-decoration: none;
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

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

.btn-danger {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(190,30,45,0.4);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: var(--red-dim);
  text-decoration: none;
  color: #ef9a9a;
}

.btn-full  { width: 100%; justify-content: center; }
.btn-sm    { padding: 5px 12px; font-size: 12px; }

.btn-remove-row {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}

.btn-remove-row:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* =============================================================================
   FILTER BAR
============================================================================= */

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
}

.filter-bar__search {
  flex: 1;
  min-width: 200px;
}

/* =============================================================================
   PAGINATION
============================================================================= */

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 16px 0;
  flex-wrap: wrap;
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface);
  transition: background 0.12s, color 0.12s;
}

.pagination__btn:hover {
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
}

.pagination__btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* =============================================================================
   DASHBOARD
============================================================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Activity Feed */
.activity-feed {
  padding: 0;
}

.activity-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: 13px;
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-row__time {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-row__actor {
  font-weight: 600;
  color: var(--teal);
  white-space: nowrap;
}

.activity-row__action {
  color: var(--text-2);
}

.activity-row__detail {
  color: var(--text-3);
  font-size: 12px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px 20px;
}

.quick-action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}

.quick-action:hover {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border-2);
  text-decoration: none;
}

.quick-action--warn {
  color: var(--amber);
  border-color: rgba(239,159,39,0.25);
}

.quick-action--warn:hover {
  background: var(--amber-dim);
  color: var(--amber);
}

/* Mini match */
.mini-match {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.12s;
}

.mini-match:last-child {
  border-bottom: none;
}

.mini-match:hover {
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text-1);
}

.mini-match__teams {
  flex: 1;
  color: var(--text-2);
}

.mini-match__date {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* =============================================================================
   LOGIN PAGE
============================================================================= */

.admin-body--login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.admin-login {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.admin-login__brand {
  text-align: center;
  margin-bottom: 32px;
}

.admin-login__brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 16px;
}

.admin-login__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}

.admin-login__sub {
  font-size: 13px;
  color: var(--text-3);
}

.admin-login__form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.admin-login__form .form-group {
  margin-bottom: 18px;
}

.admin-login__footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
}

/* =============================================================================
   TABS
============================================================================= */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-nav__btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-nav__btn:hover {
  color: var(--text-1);
}

.tab-nav__btn.active {
  color: var(--text-1);
  border-bottom-color: var(--red);
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
}

/* =============================================================================
   MEMBER DETAIL
============================================================================= */

.detail-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
  padding: 20px;
}

.detail-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.member-avatar {
  display: flex;
  justify-content: center;
}

.member-avatar__img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-2);
}

.member-avatar__placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 3px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--stone);
}

.detail-aside__info {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-aside__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.detail-aside__danger {
  margin-top: auto;
}

.detail-main {
  min-width: 0;
}

.detail-info-grid {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-info-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.detail-info-row:last-child {
  border-bottom: none;
}

.detail-info-label {
  font-weight: 500;
  color: var(--text-3);
  min-width: 160px;
  flex-shrink: 0;
}

.detail-info-value {
  color: var(--text-1);
}

/* =============================================================================
   MEMBER CREATE: TYPE SELECTOR
============================================================================= */

.type-selector {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 28px;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 140px;
}

.type-card input[type="radio"] {
  display: none;
}

.type-card:hover {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.type-card--active {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.type-card__icon {
  color: var(--teal);
}

.type-card__label {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-1);
}

.type-card__sub {
  font-size: 12px;
  color: var(--text-3);
}

/* =============================================================================
   MEMBER CREATE: TIER CARDS
============================================================================= */

.tier-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.tier-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tier-card input[type="radio"] {
  display: none;
}

.tier-card:hover {
  border-color: var(--border-2);
  background: var(--surface-3);
}

.tier-card--active {
  border-color: var(--red);
  background: var(--red-dim);
}

.tier-card__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
}

.tier-card__price {
  font-size: 12px;
  font-weight: 500;
  color: var(--stone);
}

/* =============================================================================
   EMERGENCY CONTACTS
============================================================================= */

.ec-slot {
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.ec-slot--hidden {
  display: none;
}

.ec-slot__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* =============================================================================
   CONTENT EDIT
============================================================================= */

.content-edit-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 20px;
  align-items: start;
}

.content-edit-main {
  min-width: 0;
}

.content-edit-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.content-edit-sidebar .admin-card {
  padding: 16px;
}

.content-edit-sidebar .form-actions {
  margin: 16px 0 0;
  padding: 0;
  border-top: none;
  background: none;
}

/* =============================================================================
   AVAILABILITY GRID
============================================================================= */

.availability-wrap {
  max-width: 100%;
}

.availability-grid th.avail-player-col {
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-2);
}

.availability-grid td.avail-player-name {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 160px;
}

.availability-grid tbody tr:hover td.avail-player-name {
  background: var(--surface-2);
}

.avail-match-col {
  min-width: 100px;
  text-align: center;
}

.avail-match-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.avail-match-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.avail-match-opp {
  font-size: 10px;
  color: var(--text-3);
  max-width: 90px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.avail-cell {
  text-align: center;
  padding: 6px;
}

.avail-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, opacity 0.15s;
  font-weight: 700;
}

.avail-btn:hover {
  transform: scale(1.15);
}

.avail-btn--available   { background: var(--green-dim);  border-color: rgba(76,175,80,0.4);    color: #81c784; }
.avail-btn--unavailable { background: var(--red-dim);    border-color: rgba(190,30,45,0.4);    color: #ef9a9a; }
.avail-btn--maybe       { background: var(--amber-dim);  border-color: rgba(239,159,39,0.4);   color: var(--amber); }
.avail-btn--unknown     { background: var(--surface-3);  border-color: var(--border-2);        color: var(--text-3); }

.avail-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.avail-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.avail-dot--available   { background: var(--green); }
.avail-dot--unavailable { background: var(--red); }
.avail-dot--maybe       { background: var(--amber); }
.avail-dot--unknown     { background: var(--surface-3); border: 1px solid var(--border-2); }

/* =============================================================================
   UTILITY
============================================================================= */

.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11px; }
.text-mono  { font-family: var(--font-mono); }
.text-muted { color: var(--text-3); }
.text-red   { color: #ef9a9a; }
.font-medium{ font-weight: 600; }
.text-right { text-align: right; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--teal);
}

/* =============================================================================
   MOBILE / RESPONSIVE
============================================================================= */

@media (max-width: 900px) {
  .admin-main {
    margin-left: 0;
  }

  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .admin-body--sidebar-open .admin-overlay {
    display: block;
  }

  .admin-header__burger {
    display: flex;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .form-grid--2,
  .form-grid--3,
  .form-grid--4 {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-aside {
    position: static;
  }

  .content-edit-grid {
    grid-template-columns: 1fr;
  }

  .content-edit-sidebar {
    position: static;
    order: -1;
  }

  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }

  .admin-header__user,
  .admin-header__role {
    display: none;
  }
}

@media (max-width: 600px) {
  .admin-content {
    padding: 16px;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .form-input,
  .filter-bar .form-select {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header__actions {
    width: 100%;
  }

  .type-selector {
    flex-direction: column;
  }

  .type-card {
    min-width: auto;
    flex-direction: row;
    justify-content: flex-start;
    padding: 14px 16px;
  }
}

/* ── Event / generic form two-column layout ─────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.form-col  { display: flex; flex-direction: column; gap: 0; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.btn-lg { height: 42px; padding: 0 24px; font-size: 14px; }
.btn-ghost--active { background: var(--surface-2); color: var(--text-1); }
.admin-card--danger { border-color: rgba(190,30,45,0.3); }
.admin-card--danger .admin-card__title { color: var(--red); }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; display: block; }
.form-textarea { height: auto; resize: vertical; padding: 10px 12px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } .form-row-2 { grid-template-columns: 1fr; } }
