/* =========================================================
   USAYESS Squad Management – Global Styles
   Shared by login, list_squads, squadbuilder, edit_squad,
   and admin dashboards
   ========================================================= */

/* Universal box-sizing and overflow prevention */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  width: 100%;
}

/* ====== Header / Topbar ====== */

.admin-topbar {
  background: #0b3e7a;
  color: #fff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  margin: 0 -24px 24px -24px;
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .02em;
}

.title {
  font-weight: 800;
  font-size: 18px;
}

.admin-nav a {
  color: #e2ecff;
  text-decoration: none;
  margin-right: 12px;
  font-size: 14px;
  font-weight: 500;
}

.admin-nav a:hover {
  text-decoration: underline;
}

.admin-nav .nav-separator {
  color: #e2ecff;
  margin: 0 4px;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  margin-left: 24px;
}

/* Mobile menu toggle (hamburger) */
.mobile-menu-toggle {
  display: none; /* Hidden by default on desktop */
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 32px;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  padding: 4px;
  z-index: 100;
}

.mobile-menu-toggle span {
  width: 100%;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.admin-user-pill {
  background: rgba(255,255,255,.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.admin-logout-form {
  margin: 0;
}

.admin-logout-form button {
  border: none;
  background: #e11d48;
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.admin-logout-form button:hover {
  background: #be123c;
}

@media (max-width: 768px) {
  .admin-topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin: 0 -12px 18px -12px;
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  
  .admin-topbar-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .admin-topbar .admin-logo img {
    height: 35px !important;
  }
  
  .admin-topbar .title {
    font-size: 14px;
  }
  
  /* Show hamburger menu button on mobile */
  .mobile-menu-toggle {
    display: flex !important;
    order: 3;
  }
  
  /* Hide navigation by default on mobile */
  .admin-nav {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: #0b3e7a;
    margin: 0 !important;
    padding: 20px;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 99;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    animation: slideDown 0.3s ease;
  }
  
  /* Show navigation when toggle is active */
  .admin-nav.mobile-nav-open {
    display: flex;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .admin-nav a,
  .admin-nav button {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .admin-nav a:hover,
  .admin-nav button:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
  }
  
  .admin-nav .nav-separator {
    display: none;
  }
  
  .admin-nav .help-header-btn {
    margin-top: 8px;
    background: #fff !important;
    color: #0b3e7a !important;
    border: 1px solid #fff !important;
    justify-content: center;
    font-weight: 600;
  }
  
  /* Admin header specific mobile styles */
  .admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .admin-topbar-right.mobile-nav-open {
    display: flex !important;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: #0b3e7a;
    padding: 20px;
    flex-direction: column !important;
    align-items: stretch !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 99;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    animation: slideDown 0.3s ease;
  }
  
  .admin-topbar-right.mobile-nav-open .admin-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 16px 0 !important;
    gap: 0 !important;
  }
  
  .admin-topbar-right.mobile-nav-open .admin-nav a {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin: 0;
    border-radius: 8px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .admin-topbar-right.mobile-nav-open .admin-user-pill,
  .admin-topbar-right.mobile-nav-open .help-header-btn,
  .admin-topbar-right.mobile-nav-open .admin-logout-form {
    width: 100%;
  }
  
  .admin-topbar-right.mobile-nav-open .help-header-btn,
  .admin-topbar-right.mobile-nav-open .admin-logout-form button {
    width: 100%;
    padding: 14px 16px;
    margin: 4px 0;
    border-radius: 8px;
    font-size: 15px;
    justify-content: center;
  }
  
  .admin-topbar-right.mobile-nav-open .admin-user-pill {
    padding: 14px 16px;
    margin: 4px 0;
    border-radius: 8px;
    text-align: center;
    background: rgba(255,255,255,0.2);
  }
  
  .admin-topbar-right:not(.mobile-nav-open) {
    display: none;
  }
}

/* ====== Base layout ====== */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f7f7fb;
  color: #222;
  margin: 0;
  padding: 24px;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Main content wrapper */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 24px;
  width: 100%;
  overflow-x: hidden;
}

/* Generic “section” blocks inside wrap */
.section {
  margin-top: 20px;
  padding: 18px 18px 16px;
  background: #f7fbff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

/* Page header helpers (optional) */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

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

/* Headers & subtitles */
h1 {
  margin: 0 0 8px;
  font-size: 24px;
  color: #0b3e7a;
}

h2 {
  font-size: 18px;
  margin: 10px 0 6px;
  color: #0b3e7a;
}

h3 {
  font-size: 16px;
  margin: 10px 0 6px;
  color: #0b3e7a;
}

p.sub {
  margin: 0 0 18px;
  color: #555;
  font-size: 14px;
}

/* Small text / hints */
.small {
  font-size: 13px;
}

.tiny {
  font-size: 11px;
}

.hint {
  color: #666;
}

/* Muted text utility */
.muted {
  color: #6b7280;
}

/* Code styling inline */
code {
  font-family: Consolas, Menlo, Monaco, monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 4px;
  border-radius: 4px;
}

/* ====== Cards & dashboard grid ====== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.card {
  border: 1px solid #dfe7f5;
  border-radius: 10px;
  padding: 16px;
  background: #f9fbff;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #0b3e7a;
}

.card p {
  margin: 0 0 10px;
  font-size: 14px;
  color: #555;
}

/* Table “card” wrapper – nice for big tables */
.table-card {
  background: #ffffff;
  border: 1px solid #d8e1eb;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
/* Summary grid for participant report */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.summary-card {
  border-radius: 10px;
  padding: 12px 14px;
  background: #f7fbff;
  border: 1px solid #d8ebff;
}

.summary-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #0b3e7a;
}

.summary-card p {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
/* ====== Messages (success / error / info) ====== */

.msg {
  background: #e5f7e8;
  border: 1px solid #b5e4bd;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  color: #216131;
  font-size: 13px;
}

.err {
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  color: #b91c1c;
  font-size: 13px;
}

/* A more generic alert box if you need it */
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* ====== Forms & inputs ====== */

label {
  display: block;
  font-weight: 600;
  margin: 0 0 4px;
  font-size: 13px;
  color: #111827;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  font-size: 13px;
  padding: 8px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
}

input[type="checkbox"] {
  transform: scale(1.05);
  margin-right: 4px;
}

/* Generic primary button */
button,
input[type="submit"] {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #0b5bd3;
  background: #0b5bd3;
  color: #ffffff;
  cursor: pointer;
  box-sizing: border-box;
}

button:hover,
input[type="submit"]:hover {
  background: #094aac;
}

/* Button-style links */
a.btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #0b5bd3;
  background: #0b5bd3;
  color: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

a.btn:hover {
  background: #094aac;
}

/* Primary emphasis button (used in pay-all, etc.) */
.btn-primary {
  background: #0b5ed7;
  border: 1px solid #0b5ed7;
  color: #ffffff;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.btn-primary:hover {
  background: #0a53be;
}

/* Secondary / info button (e.g. “View Event Info”) */
.info {
  background: #ffffff;
  border: 1px solid #0b5ed7;
  color: #0b5ed7;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}

.info:hover {
  background: #e0edff;
}

/* Text-only icon/action buttons (Edit/Delete links) */
.no-border-button {
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: #0b5bd3;
}

.no-border-button:hover {
  text-decoration: underline;
}

/* Danger buttons (delete actions) */
.danger-btn {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

.danger-btn:hover {
  background: #b91c1c;
}

/* Form row for "add new X" sections (admin events, etc.) */
.add-form {
  display: grid;
  gap: 10px;
  align-items: end;
  margin: 18px 0 24px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 13px;
}

/* Inline edit forms inside table rows */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inline-form input[type="text"],
.inline-form input[type="date"] {
  width: 140px;
}

/* Utility widths for event forms */
.inline-form .event-name {
  width: 180px;
}

.inline-form .base-path {
  width: 170px;
}

/* Simple horizontal form row */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ====== Login layout helpers ====== */

/* Centered shell for login page */
.auth-shell {
  max-width: 420px;
  margin: 0 auto;
}

.login-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #dfe7f5;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  padding: 20px 18px 18px;
}

.login-header {
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.login-header p.sub {
  margin-bottom: 0;
}

.login-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.login-footer {
  margin-top: 14px;
  font-size: 12px;
  color: #6b7280;
}

/* ====== Tables ====== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
}

th,
td {
  border: 1px solid #dfe7f5;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f6fb;
  font-weight: 600;
}

/* Softer / modern table borders (optional tweak) */
table,
th,
td {
  border-color: #d4d8dd;
}

/* Zebra striping for squad list & other tables */
table tbody tr:nth-child(odd) {
  background: #f9fafb;
}

table tbody tr:nth-child(even) {
  background: #ffffff;
}

/* Hover highlight */
table tbody tr:hover {
  background: #eef5ff;
  transition: background 0.15s ease-in-out;
}

/* Column width helpers for squad list */
th.col-index,
td.col-index {
  text-align: center;
  white-space: nowrap;
}

th.col-status,
td.col-status {
  text-align: center;
  white-space: nowrap;
}

th.col-action,
td.col-action {
  text-align: center;
  white-space: nowrap;
}

th.col-money,
td.col-money {
  text-align: right;
  white-space: nowrap;
}

/* Make multi-line text cols breathe a bit */
td.small {
  font-size: 0.92rem;
  line-height: 1.4;
}

/* Status tags */
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.tag.active {
  background: #e5f7e8;
  color: #216131;
  border: 1px solid #b5e4bd;
}

.tag.inactive {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ====== Payment panel ====== */

.pay-panel {
  margin-top: 18px;
  padding: 14px;
  background: #f7fbff;
  border: 1px solid #d8ebff;
  border-radius: 6px;
}

/* ====== Utility / legacy helpers ====== */

/* Some older templates may still use these */
.body,
.fullbody {
  width: 100%;
}

notice {
  font-size: 12px;
  color: #7f1d1d;
  display: block;
}

/* Unregistered / non-member sections in forms */
.unreg-section {
  background: #f9fafb;
  border-radius: 8px;
}

/* Spacing helper for stacked forms/groups */
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Simple pill badge (if needed) */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 500;
}

/* ====== Squadding public view ====== */

.event-select {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.event-select label {
  font-weight: 600;
  margin-right: 4px;
}

.search-bar {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.search-bar label {
  font-weight: 600;
  margin-right: 4px;
}

.search-bar input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
}

.search-bar button {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 0.85rem;
}

.search-bar button:hover {
  background: #e5e7eb;
}

.rotation-block {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 10px 6px;
  background: #f9fafb;
}

.rotation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 8px;
  flex-wrap: wrap;
}

.rotation-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.rotation-header .small {
  font-size: 0.8rem;
  color: #6b7280;
}

.rotation-layout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 4px;
}

.rotation-main {
  flex: 4;
  min-width: 0;
}

.rotation-side {
  flex: 1;
  min-width: 180px;
  max-width: 240px;
}

.squad-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.squad-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* keep columns readable with horizontal scroll */
}

.squad-table th,
.squad-table td {
  border: 1px solid #e5e7eb;
  padding: 2px 4px;
  font-size: 0.72rem;
}

.squad-table th {
  background: #e5e7eb;
}

.squad-table td.time-cell {
  white-space: nowrap;
  font-weight: 600;
}

.squad-table td.field-cell {
  white-space: nowrap;
  text-align: center;
  font-weight: 600;
}

.ath-cell {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ath-cell .bib-tag {
  font-weight: 700;
  margin-right: 2px;
  font-size: 0.72rem;
  display: inline-block;
}

.ath-cell .name-tag {
  font-weight: 500;
  font-size: 0.72rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ath-cell .team-tag {
  display: block;
  font-size: 0.65rem;
  color: #6b7280;
  margin-top: 1px;
}

.unsq-panel {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f3f4f6;
  padding: 4px 6px;
  max-height: 220px;
  overflow-y: auto;
}

.unsq-item {
  padding: 2px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.75rem;
}

.unsq-item:last-child {
  border-bottom: none;
}

.unsq-item .bib-tag {
  font-weight: 700;
  margin-right: 3px;
  font-size: 0.72rem;
}

.unsq-item .name-tag {
  font-weight: 500;
  font-size: 0.75rem;
}

.unsq-item .team-tag {
  display: block;
  font-size: 0.65rem;
  color: #6b7280;
}

.tiny-note {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 4px;
}

/* -------- Mobile tweaks for squadding -------- */

@media (max-width: 768px) {
  .event-select {
    align-items: flex-start;
  }

  .search-bar {
    align-items: flex-start;
  }

  .rotation-layout {
    flex-direction: column;
  }

  .rotation-side {
    min-width: 0;
  }

  .rotation-block {
    padding: 8px 8px 6px;
  }

  .squad-table {
    min-width: 560px;
  }

  .squad-table th,
  .squad-table td {
    padding: 3px 4px;
    font-size: 0.8rem;
  }

  .ath-cell .team-tag {
    font-size: 0.7rem;
  }

  .unsq-item {
    font-size: 0.8rem;
  }

  .tiny-note {
    font-size: 0.75rem;
  }

  .event-select button.btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* -------- Print layout for squadding -------- */

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .wrap {
    max-width: none;
    margin: 0;
  }

  h1,
  h2 {
    page-break-after: avoid;
  }

  .squad-table th,
  .squad-table td,
  .unsq-item {
    font-size: 0.8rem;
  }
}

.score-input {
  width: 6ch;
  box-sizing: border-box;
  text-align: center;
}


/* ====== Utility Classes ====== */

/* Margin utilities */
.mt-0{margin-top:0;}
.mt-4{margin-top:4px;}
.mt-6{margin-top:6px;}
.mt-8{margin-top:8px;}
.mt-10{margin-top:10px;}
.mt-12{margin-top:12px;}
.mt-14{margin-top:14px;}
.mt-16{margin-top:16px;}
.mt-18{margin-top:18px;}
.mt-20{margin-top:20px;}
.mt-24{margin-top:24px;}
.mb-4{margin-bottom:4px;}
.mb-6{margin-bottom:6px;}
.mb-8{margin-bottom:8px;}
.mb-10{margin-bottom:10px;}
.mb-12{margin-bottom:12px;}
.mb-16{margin-bottom:16px;}
.mb-20{margin-bottom:20px;}
.mb-24{margin-bottom:24px;}
.ml-6{margin-left:6px;}
.ml-8{margin-left:8px;}
.ml-auto{margin-left:auto;}
.mr-12{margin-right:12px;}
.m-6-0{margin:6px 0;}
.m-10-0-6{margin:10px 0 6px;}
.m-6-0-12{margin:6px 0 12px 0;}

/* Width utilities */
.w-100{width:100%;}
.w-130{width:130px;}
.w-140{max-width:140px;}
.w-160{width:160px;}
.w-180{max-width:180px;}
.w-210{max-width:210px;}
.w-220{max-width:220px;}
.maxw-180{max-width:180px;}
.maxw-260{max-width:260px;}
.width-8pct{width:8%;}
.width-12pct{width:12%;}
.width-14pct{width:14%;}
.width-60px{width:60px;}
.width-70px{width:70px;}
.width-90px{width:90px;}
.width-110px{width:110px;}
.width-120px{width:120px;}
.width-160px{width:160px;}
.width-220px{width:220px;}
.width-240px{width:240px;}
.min-w-0{min-width:0;}
.min-w-240{min-width:240px;}
.min-w-300{min-width:300px;}
.min-w-360{min-width:360px;}
.min-w-420{min-width:420px;}

/* Height utilities */
.min-h-60{min-height:60px;}
.min-h-80{min-height:80px;}
.min-h-200{min-height:200px;}

/* Flexbox utilities */
.flex-display{display:flex;}
.flex-wrap-gap{display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
.flex-end{align-items:flex-end;}
.flex-gap-6{gap:6px;}
.flex-gap-10{gap:10px;}
.flex-gap-12{gap:12px;}
.flex-gap-16{gap:16px;}
.flex-align-center{align-items:center;}
.flex-space-between{justify-content:space-between;}
.flex-1{flex:1;}
.flex-1-260{flex:1 1 260px;}
.flex-3{flex:3;}
.gap-20{gap:20px;}
.grid-gap-20{gap:20px;}

/* Display utilities */
.inline{display:inline;}
.inline-block{display:inline-block;}
.display-none{display:none;}
.hidden{display:none !important;}

/* Text utilities */
.text-center{text-align:center;}
.text-right{text-align:right;}
.text-uppercase{text-transform:uppercase;}
.nowrap{white-space:nowrap;}
.font-mono{font-family:monospace;}
.font-13{font-size:13px;}
.font-15{font-size:15px;}
.tiny{font-size:11px;}
.small{font-size:13px;}

/* Color utilities */
.color-danger{color:#b91c1c;}
.color-muted{color:#6b7280;}
.color-tbd{color:#9ca3af;}
.color-success{color:#006400;}
.muted{color:#6b7280;}

/* Background utilities */
.bg-f8fafc{background:#f8fafc;}

/* Padding utilities */
.padding-12{padding:12px;}

/* Miscellaneous utilities */
.cursor-default{cursor:default;}
.resize-vertical{resize:vertical;}

/* Component utilities */
.section--success{border-left:6px solid #16a34a;background:#ecfdf5;padding:14px 16px;border-radius:12px;margin-bottom:14px;}
.section--danger{border-left:6px solid #dc2626;background:#fef2f2;padding:14px 16px;border-radius:12px;margin-bottom:14px;}
.btn-row{display:flex;gap:10px;flex-wrap:wrap;}
.btn-link{color:#0b5bd3;text-decoration:none;}
.btn-link:hover{text-decoration:underline;}
.hint{color:#666;}
.slot-label{display:block;font-size:11px;}
.row-form{display:inline-block;}
.ok{background:#e5f7e8;border:1px solid #b5e4bd;padding:10px 12px;border-radius:8px;color:#216131;font-size:13px;}
.unsquadded-item{padding:4px 0;border-bottom:1px solid #e5e7eb;font-size:0.85rem;}
.unsquadded-item:last-child{border-bottom:none;}
.add-form-grid-cols{grid-template-columns:1.6fr 1fr 1.8fr 140px;}
.admin-help-box{margin-bottom:10px;padding:10px;background:#f7fbff;border:1px solid #e2e8f0;border-radius:6px;}
.preview-box{margin-top:8px;padding:12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;}


/* ====== Team Registration & Typeahead Components ====== */

/* Typeahead search */
.typeahead-wrap {
  position: relative;
  width: min(520px, 100%);
}

.typeahead-results {
  position: absolute;
  z-index: 50;
  margin-top: 4px;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  width: min(520px, 100%);
}

.typeahead-item {
  padding: 10px 12px;
  cursor: pointer;
}

.typeahead-item:hover {
  background: rgba(0,0,0,.06);
}

.typeahead-item.active {
  background: rgba(11, 62, 122, 0.10);
}

.typeahead-status {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}

/* Athlete slot layout */
.athlete-slot {
  margin-bottom: 16px;
}

.athlete-member-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.athlete-member-row .athlete-search {
  flex: 1 1 280px;
}

.athlete-member-row .athlete-clear {
  flex: 0 0 auto;
}

.athlete-display {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.9;
}

.athlete-nonmember-row {
  margin-top: 10px;
}

.athlete-nonmember-row label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button-link {
  text-decoration: none;
}

.unreg-title {
  font-size: 15px;
  margin: 0 0 8px;
}

/* ====== Additional Components ====== */

.notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.25);
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.compact-list li {
  margin: 0;
}

.button--danger {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
}

tr.row-too-high td {
  background: rgba(255,0,0,0.06);
}

.help-header-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0b3e7a;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.help-header-btn:hover {
  background: #f1f5f9;
}

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

/* Tablet and below (<=768px) */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  .wrap {
    padding: 16px;
    border-radius: 8px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  h2 {
    font-size: 16px;
  }
  
  h3 {
    font-size: 14px;
  }
  
  /* Grid and card layouts */
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .card {
    padding: 12px;
  }
  
  .section {
    padding: 12px;
  }
  
  /* Forms */
  .form-row {
    flex-direction: column;
    gap: 4px;
  }
  
  .form-row input[type="text"],
  .form-row input[type="email"],
  .form-row input[type="number"],
  .form-row select,
  .form-row textarea {
    width: 100%;
  }
  
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-actions .btn,
  .form-actions button,
  .form-actions input[type="submit"] {
    width: 100%;
  }
  
  .athlete-member-row {
    flex-direction: column;
  }
  
  .athlete-member-row .athlete-search {
    flex: 1 1 100%;
  }
  
  /* Buttons */
  .btn,
  button,
  input[type="submit"] {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .page-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  
  .page-actions .btn,
  .page-actions button,
  .page-actions a {
    width: 100%;
    text-align: center;
  }
  
  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Tables - make scrollable horizontally */
  .table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    font-size: 12px;
    min-width: 100%;
  }
  
  th, td {
    padding: 6px 4px;
    font-size: 12px;
  }
  
  /* Rotation/squadding layouts */
  .rotation-layout {
    flex-direction: column;
    gap: 12px;
  }
  
  .rotation-side {
    min-width: 100%;
  }
  
  .squad-table {
    min-width: 500px;
  }
  
  .squad-table th,
  .squad-table td {
    padding: 4px 3px;
    font-size: 11px;
  }
  
  /* Summary grid */
  .summary-grid {
    grid-template-columns: 1fr;
  }
  
  /* Typeahead */
  .typeahead-wrap {
    width: 100%;
  }
  
  .typeahead-results {
    width: 100%;
  }
  
  /* Search bar */
  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-bar input[type="text"] {
    min-width: 100%;
  }
  
  .search-bar button {
    width: 100%;
  }
  
  /* Event select */
  .event-select {
    flex-direction: column;
    align-items: stretch;
  }
  
  /* Smaller text for space conservation */
  .ath-cell .team-tag {
    font-size: 10px;
  }
  
  /* Make images responsive */
  img {
    max-width: 100%;
    height: auto;
  }
  
  .admin-logo img,
  .admin-topbar img {
    height: 35px !important;
  }
}

/* Phone and small devices (<=480px) */
@media (max-width: 480px) {
  body {
    padding: 2px;
  }
  
  .wrap {
    padding: 6px;
    border-radius: 6px;
  }
  
  h1 {
    font-size: 18px;
  }
  
  h2 {
    font-size: 15px;
  }
  
  h3 {
    font-size: 14px;
  }
  
  .card {
    padding: 10px;
  }
  
  .section {
    padding: 10px;
  }
  
  /* Even smaller tables on phones */
  table {
    font-size: 11px;
  }
  
  th, td {
    padding: 4px 2px;
    font-size: 11px;
  }
  
  .squad-table th,
  .squad-table td {
    padding: 3px 2px;
    font-size: 10px;
  }
  
  /* Buttons on phones */
  .btn,
  button,
  input[type="submit"] {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .admin-logo img,
  .admin-topbar img {
    height: 30px !important;
  }
  
  .title {
    font-size: 14px;
  }
}

/* Mobile-specific table alternative - card layout */
@media (max-width: 600px) {
  .mobile-card-table {
    display: block;
  }
  
  .mobile-card-table thead {
    display: none;
  }
  
  .mobile-card-table tbody {
    display: block;
  }
  
  .mobile-card-table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #d4d8dd;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
  }
  
  .mobile-card-table td {
    display: block;
    border: none;
    padding: 4px 0;
    text-align: left !important;
  }
  
  .mobile-card-table td:before {
    content: attr(data-label);
    font-weight: 600;
    display: inline-block;
    margin-right: 8px;
    color: #0b3e7a;
  }
  
  /* Leaderboard specific mobile styles */
  .leaderboard-table thead {
    display: none;
  }
  
  .leaderboard-table tbody {
    display: block;
  }
  
  .leaderboard-table tr {
    display: block;
    margin-bottom: 16px;
    border: 2px solid #d4d8dd;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
  }
  
  .leaderboard-table tr:hover {
    background: #f8fbff;
    border-color: #0b3e7a;
  }
  
  .leaderboard-table td {
    display: block;
    border: none;
    padding: 8px 0;
    text-align: left !important;
    font-size: 14px;
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  .leaderboard-table td:before {
    content: attr(data-label);
    font-weight: 700;
    display: block;
    color: #0b3e7a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
  }
  
  .leaderboard-table td[data-label="Place"] {
    font-size: 18px;
    font-weight: 700;
    padding: 6px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 6px;
  }
  
  .leaderboard-table td[data-label="Score"] {
    font-size: 18px;
    font-weight: 700;
    color: #0b3e7a;
    padding: 6px 0;
    border-top: 2px solid #e2e8f0;
    margin-top: 6px;
  }
  
  .leaderboard-table td[data-label="Athlete"] {
    font-weight: 600;
    font-size: 16px;
  }
  
  /* Make dropdowns and inputs more touch-friendly */
  select,
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea {
    min-height: 44px;
    font-size: 16px !important; /* Prevent iOS zoom on focus */
  }
  
  /* Improve readability of small text on mobile */
  .tiny-note,
  .small {
    font-size: 13px;
  }
  
  /* Make links more touch-friendly */
  a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* Navigation separator visibility */
  .nav-separator {
    display: none;
  }
  
  /* Squad list table mobile styles */
  .squad-list-table thead {
    display: none;
  }
  
  .squad-list-table tbody {
    display: block;
  }
  
  .squad-list-table tr {
    display: block;
    margin-bottom: 20px;
    border: 2px solid #d4d8dd;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    position: relative;
  }
  
  .squad-list-table td {
    display: block;
    border: none;
    padding: 8px 0;
    text-align: left !important;
  }
  
  .squad-list-table td:before {
    content: attr(data-label);
    font-weight: 700;
    display: block;
    color: #0b3e7a;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
  }
  
  /* Squad number badge */
  .squad-list-table td[data-label=\"#\"] {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: #0b3e7a;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    padding: 0;
  }
  
  .squad-list-table td[data-label=\"#\"]:before {
    display: none;
  }
  
  /* Status tags in mobile */
  .squad-list-table td[data-label=\"Status\"] {
    padding: 12px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 8px;
  }
  
  .squad-list-table td[data-label=\"Status\"] .tag {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  /* Financial information styling */
  .squad-list-table td[data-label=\"Total\"],
  .squad-list-table td[data-label=\"Paid\"],
  .squad-list-table td[data-label=\"Balance Due\"] {
    font-size: 16px;
    padding: 6px 0;
  }
  
  .squad-list-table td[data-label=\"Balance Due\"] {
    font-size: 18px;
    color: #0b3e7a;
    font-weight: 700;
    padding: 12px 0;
    border-top: 2px solid #e2e8f0;
    margin-top: 8px;
  }
  
  /* Action buttons in mobile */
  .squad-list-table td[data-label=\"Edit\"],
  .squad-list-table td[data-label=\"Delete\"],
  .squad-list-table td[data-label=\"Pay\"] {
    padding: 8px 0;
  }
  
  .squad-list-table td[data-label=\"Edit\"] form,
  .squad-list-table td[data-label=\"Delete\"] form,
  .squad-list-table td[data-label=\"Pay\"] form {
    width: 100%;
  }
  
  .squad-list-table td[data-label=\"Edit\"] button,
  .squad-list-table td[data-label=\"Delete\"] button,
  .squad-list-table td[data-label=\"Pay\"] button {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 8px;
  }
  
  .squad-list-table td[data-label=\"Pay\"] input[type=\"text\"] {
    width: 100%;
    margin-top: 8px;
  }
  
  .squad-list-table td[data-label=\"Pay\"] label {
    display: block;
    width: 100%;
  }
  
  /* Events and Athletes fields */
  .squad-list-table td[data-label=\"Events\"],
  .squad-list-table td[data-label=\"Athletes\"] {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    margin: 4px 0;
  }
  
  .squad-list-table td[data-label=\"Comments\"] {
    font-style: italic;
    color: #555;
    padding: 8px 0;
  }
  
  /* Squadding table mobile styles */
  .squadding-table thead {
    display: none;
  }
  
  .squadding-table tbody {
    display: block;
  }
  
  .squadding-table tr {
    display: block;
    margin-bottom: 20px;
    border: 2px solid #d4d8dd;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
  }
  
  .squadding-table td {
    display: block;
    border: none;
    padding: 8px 0;
    text-align: left !important;
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  .squadding-table td:before {
    content: attr(data-label);
    font-weight: 700;
    display: inline-block;
    min-width: 90px;
    color: #0b3e7a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  /* Time and Field highlighted */
  .squadding-table td[data-label=\"Time\"],
  .squadding-table td[data-label=\"Field\"],
  .squadding-table td.time-cell,
  .squadding-table td.field-cell {
    font-size: 18px !important;
    font-weight: 700 !important;
    padding: 10px !important;
    background: #f0f7ff !important;
    border-radius: 6px !important;
    margin: 6px 8px !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    box-sizing: border-box !important;
  }
  
  .squadding-table td[data-label=\"Time\"]:before,
  .squadding-table td[data-label=\"Field\"]:before {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
  }
  
  .squadding-table td[data-label=\"Field\"],
  .squadding-table td.field-cell {
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
  }
  
  /* Athlete cells styling */
  .squadding-table td.ath-cell {
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
  }
  
  .squadding-table td.ath-cell:first-of-type {
    border-top: none;
  }
  
  .squadding-table td.ath-cell:before {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
  }
  
  .squadding-table td.ath-cell:empty {
    display: none;
  }
  
  .squadding-table .bib-tag {
    display: inline-block;
    background: #0b3e7a;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    margin-right: 8px;
  }
  
  .squadding-table .name-tag {
    font-weight: 600;
    font-size: 14px;
  }
  
  .squadding-table .team-tag {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 4px;
    margin-left: 0;
  }
  
  /* Rotation layout on mobile */
  .rotation-layout {
    flex-direction: column;
  }
  
  .rotation-side {
    margin-top: 20px;
  }
  
  .unsq-panel {
    max-height: none;
  }
}
