:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --muted: #c8d3df;
  --subtle: #8fa0ae;
  --panel: rgba(7, 18, 31, 0.78);
  --panel-strong: rgba(8, 22, 39, 0.92);
  --line: rgba(255, 255, 255, 0.15);
  --gold: #f5c75b;
  --gold-strong: #ffb92e;
  --blue: #123b72;
  --cyan: #70d7ff;
  --danger: #ff7272;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --neon-pink: #ff1493;
  --neon-blue: #00d4ff;
  --neon-green: #39ff14;
  --electric-purple: #8b00ff;
  --vibrant-red: #ff0040;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(1, 5, 15, 0.95) 0%, rgba(5, 20, 40, 0.9) 50%, rgba(1, 10, 25, 0.95) 100%),
    url("assets/sports-fest-bg.jpeg") center top / cover fixed no-repeat;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 68% 16%, rgba(255, 20, 147, 0.15), transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1), transparent 50%),
    linear-gradient(90deg, rgba(5, 13, 27, 0.92) 0%, rgba(5, 13, 27, 0.6) 42%, rgba(5, 13, 27, 0.8) 100%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid;
  border-image: linear-gradient(90deg, rgba(255, 20, 147, 0.6) 0%, rgba(0, 212, 255, 0.6) 100%) 1;
  background: linear-gradient(180deg, rgba(8, 22, 39, 0.85) 0%, rgba(8, 22, 39, 0.7) 100%);
}

.brand,
.top-nav,
.hero-actions,
.record-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  border: 2px solid;
  border-image: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-blue) 100%) 1;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 20px rgba(255, 20, 147, 0.4), inset 0 0 15px rgba(0, 212, 255, 0.15);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.top-nav {
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(255, 20, 147, 0.3);
  border-radius: 999px;
  background: rgba(4, 12, 24, 0.7);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.top-nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-nav a:hover {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.2), rgba(0, 212, 255, 0.2));
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(430px, 1.1fr);
  align-items: center;
  gap: 36px;
  padding: 34px 0 48px;
}

.hero-copy {
  max-width: 620px;
  padding-top: 12vh;
  align-self: start;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  background: linear-gradient(135deg, #f8fbff 0%, var(--neon-blue) 50%, var(--neon-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

.hero-copy p {
  max-width: 590px;
  color: #eef5fb;
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-actions,
.record-actions {
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action,
.submit-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.primary-action,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #07121f;
  background: linear-gradient(135deg, #ffe08b, var(--gold-strong));
  box-shadow: 0 0 20px rgba(255, 185, 46, 0.4), 0 12px 28px rgba(255, 185, 46, 0.24);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.primary-action:hover,
.submit-button:hover {
  box-shadow: 0 0 30px rgba(255, 185, 46, 0.6), 0 16px 32px rgba(255, 185, 46, 0.3);
  transform: translateY(-2px);
}

.secondary-action,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.danger-button {
  color: #ffe9e9;
  background: rgba(255, 114, 114, 0.16);
  border: 1px solid rgba(255, 114, 114, 0.38);
}

.small {
  min-height: 40px;
  padding-inline: 14px;
  font-size: 0.9rem;
}

.registration-panel,
.dashboard-band,
.records-band,
.aws-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.registration-panel {
  padding: 22px;
}

.panel-heading,
.section-heading,
.filter-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading {
  margin-bottom: 18px;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 2vw, 2.2rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 16px;
  font-size: 1.02rem;
}

.panel-heading p,
.section-heading p,
.aws-grid span {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.fee-preview {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--gold);
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  background: rgba(245, 199, 91, 0.1);
}

.registration-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label,
legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  background: rgba(2, 9, 19, 0.76);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(245, 199, 91, 0.82);
  box-shadow: 0 0 0 3px rgba(245, 199, 91, 0.16);
}

/* Keep the community dropdown the exact same box size as the age field */
#age,
#community {
  height: 44px;
  min-height: 44px;
}

.sports-fieldset {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.sports-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.sports-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.sports-category {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.sports-category legend {
  color: var(--gold);
  font-weight: 600;
  padding: 0 8px;
  margin-left: -8px;
}

.sports-category.kids-category legend {
  color: #70d7ff;
}

.sports-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.sport-option-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sport-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.sport-option input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.sport-option span {
  color: var(--gold);
  font-weight: 800;
}

.sport-options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 8px;
  border-left: 2px solid var(--gold);
  margin-left: 8px;
  padding-left: 12px;
}

.sport-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sport-detail label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.sport-detail input,
.sport-detail select {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: inherit;
}

.sport-detail input:focus,
.sport-detail select:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.12);
}

.sport-detail small {
  font-size: 12px;
  color: var(--subtle);
}

.partner-input {
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.submit-button,
.form-status {
  grid-column: 1 / -1;
}

.form-status {
  min-height: 24px;
  margin: 0;
  color: var(--cyan);
  font-weight: 700;
}

.dashboard-band,
.records-band,
.aws-band {
  margin: 28px 0;
  padding: 28px;
  background: var(--panel-strong);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.metric-card {
  min-height: 116px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.08), rgba(255, 20, 147, 0.04));
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1), inset 0 0 15px rgba(0, 212, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
}

.metric-card:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), inset 0 0 20px rgba(0, 212, 255, 0.1);
  transform: translateY(-4px);
}

.metric-card span {
  display: block;
  color: var(--subtle);
  font-size: 0.84rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  color: var(--neon-blue);
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  line-height: 1;
  text-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.chart-panel {
  min-height: 290px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.05), rgba(255, 20, 147, 0.03));
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.08), inset 0 0 15px rgba(0, 212, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.chart-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.summary-row strong {
  font-size: 0.92rem;
}

.summary-row small {
  color: var(--muted);
}

.bar-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
}

.compact .summary-row {
  grid-template-columns: minmax(120px, 1fr) auto;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.filter-row {
  margin: 22px 0 16px;
}

.filter-row label:first-child {
  flex: 1 1 460px;
}

.filter-row label:last-child {
  flex: 0 1 280px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: rgba(2, 9, 19, 0.48);
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #eaf0f6;
  font-size: 0.92rem;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
}

.aws-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.aws-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.aws-grid strong,
.aws-grid span {
  display: block;
}

.aws-grid strong {
  margin-bottom: 8px;
  color: var(--gold);
}

@media (max-width: 980px) {
  body {
    background-attachment: scroll;
  }

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

  .hero-copy {
    padding-top: 3vh;
  }

  .metric-grid,
  .aws-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(calc(100vw - 20px), 370px);
    margin: 0;
    padding: 0 10px;
  }

  .site-header,
  .panel-heading,
  .section-heading,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .top-nav {
    justify-content: space-between;
    border-radius: 8px;
  }

  .top-nav a {
    flex: 1;
    text-align: center;
  }

  .registration-panel,
  .dashboard-band,
  .records-band,
  .aws-band {
    padding: 18px;
  }

  .registration-form,
  .sports-options,
  .metric-grid,
  .aws-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2.15rem, 9.5vw, 2.7rem);
    line-height: 1;
  }

  .hero-copy,
  .hero-copy p {
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
    overflow-wrap: break-word;
  }

  .registration-panel,
  .dashboard-band,
  .records-band,
  .aws-band {
    width: min(calc(100vw - 20px), 370px);
    max-width: min(calc(100vw - 20px), 370px);
  }

  .summary-row {
    grid-template-columns: 1fr auto;
  }

  .summary-row .bar-track {
    grid-column: 1 / -1;
  }
}

/* ========== Admin & User Retrieval Styles ========== */

.admin-panel-hidden {
  display: none;
}

.admin-logout-hidden {
  display: none;
}

.admin-login-hidden {
  display: none;
}

.admin-password-hidden {
  display: none;
}

.admin-only-hidden {
  display: none;
}

.fee-metric-hidden {
  display: none;
}

.fee-summary-hidden {
  display: none;
}

.user-search-result-hidden {
  display: none;
}

.admin-data-section-hidden {
  display: none;
}

.admin-toggle {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.admin-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--gold);
}

.admin-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 100;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  min-width: 280px;
}

.admin-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-content label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-content input {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(2, 9, 19, 0.76);
}

.admin-content button {
  padding: 10px 16px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

#adminLogin {
  background: linear-gradient(135deg, #ffe08b, var(--gold-strong));
  color: #07121f;
}

#adminLogout {
  background: rgba(255, 114, 114, 0.16);
  color: #ffe9e9;
  border: 1px solid rgba(255, 114, 114, 0.38);
}

.admin-status {
  font-size: 0.9rem;
  padding: 8px;
  border-radius: 4px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

/* User Retrieval Section */
.user-retrieval-section {
  margin-bottom: 32px;
  padding: 18px;
  border: 1px solid rgba(112, 215, 255, 0.2);
  border-radius: 8px;
  background: rgba(112, 215, 255, 0.05);
}

.user-retrieval-section h3 {
  color: var(--cyan);
  margin-bottom: 10px;
}

.user-retrieval-section p {
  color: var(--muted);
  margin-bottom: 16px;
}

.user-search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.user-search-row label {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#userPhoneSearch {
  min-height: 44px;
}

#searchUserBtn {
  min-height: 44px;
  padding: 0 20px;
  white-space: nowrap;
}

.user-search-result {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  background: rgba(112, 215, 255, 0.08);
}

.user-detail-card h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--cyan);
  font-size: 1.1rem;
}

.detail-group {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(112, 215, 255, 0.1);
}

.detail-group:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.detail-group label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-group span {
  color: var(--ink);
  line-height: 1.5;
}

.detail-group ul {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.detail-group li {
  margin: 4px 0;
}

.user-search-result > div {
  margin-bottom: 16px;
}

.user-search-result > button {
  margin-right: 8px;
  margin-bottom: 8px;
}

/* Admin Data Section */
.admin-data-section {
  margin-bottom: 32px;
  padding: 18px;
  border: 1px solid rgba(245, 199, 91, 0.2);
  border-radius: 8px;
  background: rgba(245, 199, 91, 0.05);
}

.admin-data-section h3 {
  color: var(--gold);
  margin-bottom: 10px;
}

.admin-data-section p {
  color: var(--muted);
  margin-bottom: 16px;
}

/* Public Data Section */
.public-data-section {
  margin-top: 16px;
}

.form-status {
  color: var(--cyan);
}

@media (max-width: 680px) {
  .admin-panel {
    position: fixed;
    top: 70px;
    right: 10px;
    left: 10px;
    min-width: auto;
  }

  .detail-group {
    grid-template-columns: 100px 1fr;
    gap: 12px;
  }

  .user-search-row {
    flex-direction: column;
  }

  .user-search-row label {
    min-width: 100%;
  }

  #searchUserBtn {
    width: 100%;
  }
}
