/* =========================================================
   USAYESS Squad Management – Global Styles
   Shared by login, list_squads, squadbuilder, edit_squad,
   and admin dashboards
   ========================================================= */

/* ====== 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-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: 700px) {
  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 0 -12px 18px -12px;
    padding: 10px 12px;
  }
  .admin-topbar-left {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ====== Base layout ====== */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f7f7fb;
  color: #222;
  margin: 0;
  padding: 24px;
}

/* Main content wrapper */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 24px;
}

/* 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: 12px;
  color: #666;
}

/* Muted text utility */
.muted {
  color: #9ca3af;
}

/* 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);
}

/* ====== 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;
}

/* 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: 16px;
  align-items: flex-start;
  margin-top: 4px;
}

.rotation-main {
  flex: 3;
  min-width: 0;
}

.rotation-side {
  flex: 1;
  min-width: 220px;
}

.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: 4px 6px;
  font-size: 0.86rem;
}

.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: nowrap;
}

.ath-cell .bib-tag {
  font-weight: 700;
  margin-right: 4px;
}

.ath-cell .name-tag {
  font-weight: 500;
}

.ath-cell .team-tag {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
}

.unsq-panel {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f3f4f6;
  padding: 6px 8px;
  max-height: 260px;
  overflow-y: auto;
}

.unsq-item {
  padding: 2px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.85rem;
}

.unsq-item:last-child {
  border-bottom: none;
}

.unsq-item .bib-tag {
  font-weight: 700;
  margin-right: 4px;
}

.unsq-item .name-tag {
  font-weight: 500;
}

.unsq-item .team-tag {
  display: block;
  font-size: 0.7rem;
  color: #6b7280;
}

.tiny-note {
  font-size: 0.8rem;
  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;
}
