/* ==========================================================================
   Rally ATL Admin Shared Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── 1. VARIABLES & CSS CUSTOM PROPERTIES ──────────────────────────────── */
:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --text: #334155;
  --text-white: #0f172a;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-hover: #059669;
  --error: #ef4444;
  --error-hover: #dc2626;
  --warning: #f59e0b;
  --glass-glow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 12px;
}

/* ── 2. BASE & RESET ───────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.03) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.02) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── 3. LAYOUT STRUCTURE ────────────────────────────────────────────────── */
.container {
  max-width: 1600px;
  width: 100%;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--glass-glow);
}

/* Header & Title Brand */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
  margin-bottom: 24px;
  gap: 10px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-badge {
  font-size: 20px;
  background: rgba(59, 130, 246, 0.08);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.logo-text {
  color: var(--text-white);
  font-size: 20px;
  font-weight: 800;
}

.logo-text span {
  color: var(--primary);
}

.admin-title-wrap {
  display: flex;
  flex-direction: column;
}

.admin-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Header Navigation & Top Actions */
#adminHeaderNav {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  width: 70%;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-mobile-menu-toggle {
  display: none;
  background: #d7e8fa;
  border: 1.5px solid var(--card-border, #cbd5e1);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white, #0f172a);
  cursor: pointer;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  outline: none;
}

.header-nav-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-block;
}

.header-nav-link:hover {
  background: #f1f5f9;
  color: var(--text-white);
}

.header-nav-link.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
}

/* Footer Layout */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
}

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

footer a:hover {
  text-decoration: underline;
}

/* ── 3.1 PAGE TITLE SECTION (Consistent Across Admin Center) ──────────── */
.section-page_title {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-page_title h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin: 0;
}

.section-page_title p {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
}

@media (min-width: 640px) {
  .section-page_title {
    margin-bottom: 24px;
  }

  .section-page_title h1 {
    font-size: 26px;
  }

  .section-page_title p {
    font-size: 14px;
  }
}

/* ── 4. REPORT LAYOUT & WORKSPACE ──────────────────────────────────────── */
.report-workspace {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── 5. DATA TABLES & TOOLBARS ─────────────────────────────────────────── */
.table-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.table-toolbar {
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box-wrap {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* Sortable Table Headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s;
}

.sortable-header:hover {
  background-color: #f1f5f9 !important;
}

.header-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.header-sort-wrap.center {
  justify-content: center;
  width: 100%;
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
  font-size: 12px;
  margin-left: 2px;
  font-weight: 800;
}

.sort-indicator.active {
  color: var(--primary);
}



.col-coach-id {
  text-align: center;
  width: 80px;
  white-space: nowrap;
}

.table-loading-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0 !important;
}

.table-empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0 !important;
}

/* Row Profile Cell Layouts */
.coach-profile-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.coach-name-wrap {
  display: flex;
  flex-direction: column;
}

.coach-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
}

.coach-alt-name {
  font-size: 11px;
  color: var(--text-muted);
}

.profile-link-btn {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  display: inline-block;
}

.profile-link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  opacity: 0.95;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 200px;
}

.tag-pill {
  background: #f1f5f9;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 500;
}

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

/* ── 6. COMPONENTS ─────────────────────────────────────────────────────── */

/* 6.1 Buttons & Icon Buttons */
.btn {
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s, border-color 0.15s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-action-remove {
  background-color: #fef2f2;
  color: var(--error-hover);
  border: 1px solid #fee2e2;
}

.btn-action-remove:hover {
  background-color: #fee2e2;
  border-color: #fca5a5;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text-white);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
}

.btn-clear {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

/* Button Icon Modifiers */
.btn-icon.edit-btn {
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.04);
}

.btn-icon.edit-btn:hover {
  color: var(--primary-hover);
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
}

.btn-icon.delete-btn {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.btn-icon.delete-btn:hover {
  color: var(--error-hover);
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

.btn-icon.active-toggle-btn.active {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.btn-icon.active-toggle-btn.active:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.5);
}

.btn-icon.active-toggle-btn.inactive {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.btn-icon.active-toggle-btn.inactive:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
}

/* 6.2 Form Controls & Inputs */
.input-full {
  grid-column: 1 / -1;
}

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

.input-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.input-control {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-white);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  outline: none;
}

.input-control.search-input {
  padding-left: 36px;
}

.input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.input-control:disabled {
  background: #f1f5f9;
  opacity: 0.6;
  cursor: not-allowed;
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.label-small {
  font-size: 10px;
  color: var(--text-muted);
}

.textarea-small {
  height: 60px;
  resize: vertical;
}

.checkbox-flex-row {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* 6.3 Badges & Status Indicators */
.status-badge {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 99px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge.connecting {
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.04);
}

.status-badge.success {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.04);
}

.status-badge.error {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-orange {
  background: #fff3e0;
  color: #e65100;
}

.badge-green {
  background: #e8f8ef;
  color: var(--success-hover);
}

.badge-blue {
  background: #e8f0ff;
  color: var(--primary-hover);
}

.badge-yellow {
  background: #fefeeb;
  color: #b58900;
}

.badge-gold {
  background: #fef9e7;
  color: #c0931a;
}

.badge-red {
  background: #fef2f2;
  color: var(--error-hover);
}

.badge-waiver {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #047857;
}

.badge-waiver.missing {
  color: #94a3b8;
  font-weight: 400;
}

.student-id-badge {
  display: inline-block;
  font-family: monospace;
  background: #eff6ff;
  color: #1e40af;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}


/* 6.5 Toggle Switches & Roster Controls */
.switch-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

.toggle-switch input:checked+.slider {
  background-color: var(--success);
}

.toggle-switch input:checked+.slider:before {
  transform: translateX(18px);
}



/* 6.7 Toast Notifications & Alerts */
.alert-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-left: 6px solid var(--primary);
  border-radius: 12px;
  padding: 16px 28px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-toast.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.alert-toast.success {
  border-left-color: var(--success);
}

.alert-toast.error {
  border-left-color: var(--error);
}



/* ── 7. RESPONSIVE MEDIA QUERIES ───────────────────────────────────────── */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 16px;
    gap: 10px;
  }

  .header-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  .admin-mobile-menu-toggle {
    display: inline-flex;
  }

  #adminHeaderNav {
    display: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-top: 10px;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  header.mobile-open .header-nav {
    display: grid !important;
    animation: fadeIn 0.2s ease-out;
  }

  .header-nav-link {
    display: block;
    text-align: center;
    padding: 10px 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
  }

  .header-nav-link.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
  }

  .status-badge {
    align-self: center;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  body {
    padding: 0px;
  }

  .container {
    padding: 6px;
    margin: 0;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
  }

  #adminHeader {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: white;
  }

  #adminHeaderNav {
    background-color: #d7e8fa;
  }

  .logo-badge {
    display: none;
  }
}