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

:root {
  --green:      #1e7a34;
  --green-dark: #145226;
  --green-lite: #e8f5e9;
  --gold:       #f5a623;
  --red:        #c62828;
  --gray:       #f4f6f8;
  --border:     #dde2e8;
  --text:       #1a1a2e;
  --sub:        #5f6b7c;
  --white:      #ffffff;
  --shadow:     0 2px 12px rgba(0,0,0,.1);
  --radius:     10px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gray);
  color: var(--text);
  min-height: 100vh;
}

/* ── Screens ────────────────────────────────────────────────────────────────── */
.screen { display: none !important; }
.screen.active { display: block !important; }
#loginScreen.active { display: flex !important; }

/* ── Login ──────────────────────────────────────────────────────────────────── */
#loginScreen {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 60%, #2e7d32 100%);
  align-items: center;
  justify-content: center;
}

.login-wrap {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
  text-align: center;
}

.login-logo { margin-bottom: 28px; }
.ball-icon { font-size: 52px; margin-bottom: 10px; }
.login-logo h1 { font-size: 22px; line-height: 1.3; color: var(--green-dark); }
.login-logo h1 span { color: var(--green); }
.tagline { color: var(--sub); font-size: 13px; margin-top: 6px; }

.login-form { text-align: left; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .2s;
  outline: none;
}
.field input:focus { border-color: var(--green); }

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s;
}
.btn-primary:hover { background: var(--green-dark); }

.demo-hint { font-size: 12px; color: var(--sub); margin-top: 20px; }
.error-msg { color: var(--red); font-size: 13px; margin: 8px 0; }
.hidden { display: none !important; }

/* ── App Header ─────────────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { font-size: 30px; }
.header-title { font-size: 18px; font-weight: 700; }
.header-sub { font-size: 12px; opacity: .8; }
.header-right { display: flex; align-items: center; gap: 12px; }
.welcome-user { font-size: 14px; opacity: .9; }

.btn-logout {
  padding: 6px 14px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 6px;
  color: var(--white);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── Tab Nav ────────────────────────────────────────────────────────────────── */
.tab-nav {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  display: flex;
  padding: 0 24px;
}

.tab-btn {
  padding: 14px 22px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  transition: color .2s, border-color .2s;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.tab-btn:hover:not(.active) { color: var(--text); }

.tab-content { display: none; padding: 24px; }
.tab-content.active { display: block; }

/* ── Filters ────────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--sub); }
.filter-group select {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--white);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.filter-group select:focus { border-color: var(--green); }

/* ── Schedule ───────────────────────────────────────────────────────────────── */
.schedule-list { display: flex; flex-direction: column; gap: 8px; }

.week-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 4px 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 8px;
}
.week-header:first-child { margin-top: 0; }

.event-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow .15s;
}
.event-card:hover { box-shadow: var(--shadow); }

.event-card.canceled {
  opacity: .65;
  background: #fff8f8;
  border-color: #f5c6c6;
}
.event-card.postponed {
  opacity: .75;
  background: #fffde7;
  border-color: #ffe082;
}

.event-icon { font-size: 26px; width: 36px; text-align: center; flex-shrink: 0; }

.event-main { flex: 1; min-width: 0; }
.event-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-meta { font-size: 13px; color: var(--sub); margin-top: 2px; }

.event-right { text-align: right; flex-shrink: 0; }
.event-time { font-size: 14px; font-weight: 600; }
.event-location { font-size: 12px; color: var(--sub); margin-top: 2px; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}
.badge-scheduled  { background: var(--green-lite); color: var(--green-dark); }
.badge-canceled   { background: #fdecea; color: var(--red); }
.badge-postponed  { background: #fff8e1; color: #e65100; }
.badge-completed  { background: #e3f2fd; color: #0277bd; }

.event-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 2px;
  letter-spacing: .02em;
}

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

.no-results {
  text-align: center;
  color: var(--sub);
  padding: 60px 20px;
  font-size: 16px;
}
.no-results .big { font-size: 48px; margin-bottom: 12px; }

/* ── Teams Grid ─────────────────────────────────────────────────────────────── */
.division-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 24px 0 10px;
  grid-column: 1 / -1;
}
.division-label:first-child { margin-top: 0; }

.division-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.team-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  position: relative;
  overflow: hidden;
}
.team-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.team-card-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.team-card-icon { font-size: 36px; margin-bottom: 8px; margin-top: 4px; }
.team-card-name { font-size: 17px; font-weight: 700; }
.team-card-div  { font-size: 12px; color: var(--sub); margin-top: 2px; }
.team-card-count { font-size: 12px; color: var(--green); font-weight: 600; margin-top: 8px; }

/* ── Team Detail Page ───────────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  margin-bottom: 20px;
  transition: background .15s, color .15s;
}
.back-btn:hover { background: var(--white); color: var(--text); }

.team-detail-header {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.team-detail-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.team-detail-icon { font-size: 52px; flex-shrink: 0; }

.team-detail-info h2 { font-size: 26px; font-weight: 800; }
.team-detail-div { font-size: 14px; color: var(--sub); margin-top: 4px; font-weight: 500; }

/* ── Sub-tabs ───────────────────────────────────────────────────────────────── */
.sub-tab-nav {
  display: flex;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
  padding: 0 4px;
  margin-bottom: 0;
}

.sub-tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.sub-tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.sub-tab-btn:hover:not(.active) { color: var(--text); }

.sub-tab-content { display: none; }
.sub-tab-content.active { display: block; }

/* ── Roster Table (full page) ───────────────────────────────────────────────── */
.roster-table.full {
  width: 100%;
  border-collapse: collapse;
  display: table;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.roster-table.full thead th {
  background: var(--green-lite);
  color: var(--green-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 20px;
  text-align: left;
}
.roster-table.full tbody tr:nth-child(even) { background: var(--gray); }
.roster-table.full tbody tr:hover { background: var(--green-lite); }
.roster-table.full td {
  padding: 12px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.roster-table.full td:first-child { font-weight: 700; width: 50px; color: var(--sub); }

#subtab-games {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tab-content { padding: 14px; }
  .filters-bar { gap: 10px; }
  .filter-group { min-width: 120px; }
  .app-header { padding: 12px 14px; }
  .header-title { font-size: 15px; }
  .team-detail-icon { font-size: 36px; }
  .team-detail-info h2 { font-size: 20px; }
}
