/* ═══════════════════════════════════════════
   CoachZone — app.css
   ═══════════════════════════════════════════ */

/* ── RESET & VARIABLES ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg:       #111;
  --surface:  #1c1c1c;
  --s2:       #252525;
  --border:   #2e2e2e;
  --text:     #f0f0f0;
  --muted:    #777;
  --green:    #3ddc84;
  --red:      #ff5f5f;
  --blue:     #5eb8ff;
  --font:     'DM Sans', sans-serif;
  --mono:     'DM Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}

input, select, textarea, button {
  font-family: var(--font);
  font-size: 15px;
}

/* ── SCREENS ── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
.screen.on { display: flex; }

/* ── LOGIN ── */
#s-login {
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 340px;
}

.login-logo {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.5px;
  margin-bottom: 2px;
}
.login-logo span { color: var(--green); }

.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ── TABS ── */
.tabs {
  display: flex;
  background: var(--surface);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  border: none;
  background: none;
  transition: all .2s;
}
.tab.on {
  background: var(--green);
  color: #000;
}

/* ── FORM FIELDS ── */
.field { margin-bottom: 12px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

input[type=text],
input[type=password],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
}

textarea {
  resize: none;
  min-height: 70px;
}

select option { background: var(--surface); }

.err {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ── BUTTONS ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
  width: 100%;
}

.btn-g  { background: var(--green); color: #000; }
.btn-g:active { filter: brightness(.9); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:active { background: var(--s2); }

.btn-r {
  background: transparent;
  border: 1px solid #3a1515;
  color: var(--red);
}
.btn-r:active { background: #3a1515; }

.btn-sm {
  padding: 7px 13px;
  width: auto;
  font-size: 13px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── APP SHELL ── */
#s-app { background: var(--bg); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-logo {
  font-weight: 600;
  font-size: 16px;
}
.topbar-logo span { color: var(--green); }

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

.av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.logout-btn:hover { color: var(--red); }

/* ── SYNC DOT ── */
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background .3s;
}
.sync-dot.syncing  { background: var(--blue);  animation: pulse 1s infinite; }
.sync-dot.synced   { background: var(--green); }
.sync-dot.error    { background: var(--red);   }
.sync-dot.offline  { background: var(--muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── BOTTOM NAV ── */
.bnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

.nitem {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: color .15s;
}
.nitem.on  { color: var(--green); }
.nitem svg { width: 19px; height: 19px; }

/* ── CONTENT & PAGES ── */
.content {
  flex: 1;
  padding: 16px 14px 90px;
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
}

.page     { display: none; }
.page.on  { display: block; }

.page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
}

.card-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── CHIPS ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.cg { background: #0d2b1a; color: var(--green); }
.cr { background: #2b0d0d; color: var(--red);   }

/* ── PLAYER ROW ── */
.p-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.p-row:last-child { border: none; }

.p-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}

/* ── ATTENDANCE TOGGLE ── */
.att-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.att-row:last-child { border: none; }

.att-name { flex: 1; font-size: 14px; }

.att-tog {
  display: flex;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.att-tog button {
  padding: 5px 12px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  background: var(--s2);
  color: var(--muted);
  transition: all .15s;
  width: auto;
}

.att-tog button.ay { background: #0d2b1a; color: var(--green); }
.att-tog button.an { background: #2b0d0d; color: var(--red);   }

/* ── GROUP CHIPS BAR ── */
.gbar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.gbar::-webkit-scrollbar { display: none; }

.gchip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.gchip.on {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

/* ── STATS ── */
.sg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.sbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px;
  text-align: center;
}

.sn {
  font-size: 28px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1;
}

.sl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── ATTENDANCE BAR ── */
.bar-w { margin-bottom: 10px; }

.bar-h {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 3px;
}
.bar-h span:last-child {
  color: var(--green);
  font-family: var(--mono);
}

.bar {
  height: 5px;
  background: var(--s2);
  border-radius: 3px;
}

.bar-f {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width .4s ease;
}
.bar-f.mid { background: var(--blue); }
.bar-f.low { background: var(--red);  }

/* ── MONTH NAV ── */
.mnav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.mnav button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mlabel {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

/* ── MODAL ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.overlay.on { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.mh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.mt { font-size: 17px; font-weight: 600; }

.mx {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

/* ── MISC ── */
.slabel {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .4px;
  text-transform: uppercase;
  margin: 12px 0 6px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: all .22s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
