/* Medford Mustangs — mobile-first, deliberately simple. Most use is on a phone.
   Palette pulled from the team's own graphics: deep navy + white, steel-blue accents,
   athletic condensed headings. No red except as a restrained "destructive" signal. */
:root {
  --navy:      #0a1c3d;   /* primary — headers, brand */
  --navy-2:    #123059;   /* gradient partner for the top bar */
  --blue:      #2f62a8;   /* steel blue — links, primary buttons */
  --blue-dark: #21497f;   /* button hover */
  --steel:     #6f8bb3;   /* muted accent lines */
  --ink:       #17233b;   /* body text (near-navy) */
  --muted:     #64748b;
  --line:      #e2e6ec;
  --bg:        #eef1f6;   /* cool light ground */
  --card:      #ffffff;
  --ok:        #e8f5ec;
  --ok-line:   #b7e1c3;
  --warn:      #fdf0e8;
  --warn-line: #f2cbb3;
  --danger:    #b3402f;   /* destructive actions only */
  --danger-2:  #8f3021;
  --shadow:    0 1px 2px rgba(10,28,61,.06), 0 4px 14px rgba(10,28,61,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--blue); }

/* Athletic condensed headings (falls back to system if the web font can't load). */
h1, h2, .brand-text strong {
  font-family: "Oswald", "Segoe UI", system-ui, sans-serif;
  letter-spacing: .01em;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: .6rem 1rem;
  border-bottom: 3px solid var(--blue);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; flex: none;
  font-family: "Oswald", sans-serif; font-weight: 700; font-size: 1.4rem; line-height: 1;
  color: var(--navy); background: #fff; border-radius: 8px;
  box-shadow: inset 0 0 0 2px var(--navy);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-weight: 700; font-size: 1.15rem; text-transform: uppercase; }
.brand-text small { font-size: .68rem; color: #b9cbe6; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.nav a { color: #cfe0f5; text-decoration: none; font-size: .95rem; padding: .2rem .6rem; border-radius: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.10); }
.nav a.active { color: var(--navy); background: #fff; font-weight: 700; }
.logout { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.who { color: #cfe0f5; font-size: .9rem; }
.logout button { background: rgba(255,255,255,.12); }
.logout button:hover { background: rgba(255,255,255,.22); }

/* ---------- Content ---------- */
.content { max-width: 900px; margin: 0 auto; padding: 1.1rem 1rem 2.5rem; }
h1 { font-size: 1.7rem; margin: .4rem 0 1rem; color: var(--navy); }
h2 { font-size: 1.15rem; color: var(--navy); }
.muted { color: var(--muted); font-size: .9rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.ok { background: var(--ok); border-color: var(--ok-line); box-shadow: none; }
.card.warn { background: var(--warn); border-color: var(--warn-line); box-shadow: none; }

/* ---------- Dashboard tiles ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.tile { text-decoration: none; color: inherit; display: block; position: relative; transition: border-color .12s, transform .12s; border-left: 4px solid var(--blue); }
.tile:hover { border-color: var(--blue); transform: translateY(-1px); }
.tile h2 { margin: 0 0 .25rem; color: var(--blue); }
.tile p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--navy); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: #f5f8fc; }

/* ---------- Definition list ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- Forms + buttons ---------- */
button {
  background: var(--blue); color: #fff; border: 0; border-radius: 7px;
  padding: .5rem .9rem; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
button:hover { background: var(--blue-dark); }
button.danger, button.btn-icon.danger, button.btn-sm.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: var(--danger-2); }
button:disabled { opacity: .35; cursor: default; }
input[type=file], input[type=text], input[type=date], select, textarea {
  font: inherit; padding: .4rem; border: 1px solid var(--line); border-radius: 7px;
  background: #fff;
}
input[type=text]:focus, input[type=date]:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue);
}
form.inline { display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 .3rem; }
.linkbox { width: 100%; padding: .5rem; font-family: monospace; }

.tag { background: var(--navy); color: #fff; border-radius: 5px; padding: .05rem .45rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.tag-coach { background: var(--muted); }
code { background: #eef1f5; padding: .1rem .3rem; border-radius: 4px; font-size: .85em; }

/* ---------- Small / icon buttons ---------- */
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-icon { padding: .25rem .5rem; font-size: .85rem; line-height: 1; background: #eef1f5; color: var(--navy); }
.btn-icon:hover:not(:disabled) { background: #dde5ef; }
.btn-icon.danger { background: #f7e0dc; color: var(--danger); }
.btn-icon.danger:hover:not(:disabled) { background: #f0cabf; }

/* ---------- Notes ---------- */
.note-form textarea, .note-edit textarea, .card textarea {
  width: 100%; resize: vertical;
}
.note-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .5rem; }
.vis-choice { font-size: .9rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.notes { margin-top: 1rem; display: grid; gap: .75rem; }
.note {
  border: 1px solid var(--line); border-left: 4px solid var(--steel);
  border-radius: 10px; padding: .6rem .8rem; background: #fbfcfe;
}
.note.note-player { border-left-color: var(--blue); background: #f1f6fc; }
.note-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; align-items: center; }
.note-who { color: var(--muted); font-size: .85rem; }
.note-body { margin: .4rem 0; white-space: pre-wrap; }
.note-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- Player attributes (strengths / areas to work on) ---------- */
.attr-list { list-style: none; margin: 0 0 .5rem; padding: 0; }
.attr-list > li { padding: .25rem 0; border-bottom: 1px solid var(--line); }
.attr-list > li:last-child { border-bottom: 0; }
.attr-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.attr-tools { display: flex; align-items: center; gap: .5rem; }
.attr-notes { margin: .3rem 0 .2rem; padding-left: 1rem; font-size: .88rem; }
.attr-notes li { margin: .15rem 0; }
.attr-add { display: flex; gap: .4rem; margin-top: .3rem; }
.attr-add input[type=text] { flex: 1; }
.note-goal { font-size: .8rem; color: var(--blue); margin-top: .3rem; font-weight: 600; }

/* Auto-condensed "Key points" summary above a long reflection / scouting report. */
.keypoints { background: #f1f6fc; border: 1px solid #cfe0f5; border-radius: 8px; padding: .5rem .7rem; margin: .5rem 0; }
.keypoints-label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--blue); margin-bottom: .25rem; }
.keypoints ul { margin: 0; padding-left: 1.1rem; }
.keypoints li { margin: .1rem 0; }

/* ---------- Team tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.tab {
  padding: .4rem .95rem; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--blue); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.tab:hover { border-color: var(--blue); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Depth chart ---------- */
.add-depth { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.depth-position h2 { margin-top: 0; }
.depth-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.depth-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.depth-item.dragging { opacity: .5; border-color: var(--blue); }
.drag-handle { cursor: grab; color: var(--steel); font-size: 1.1rem; touch-action: none; user-select: none; }
.depth-rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: .8rem; font-weight: 700;
}
.depth-name { flex: 1; }
.depth-actions { display: flex; gap: .25rem; margin-left: auto; }
/* Projected starters — top N at each position. */
.depth-item.starter { border-color: var(--blue); background: #eef4fb; box-shadow: inset 3px 0 0 var(--blue); }
.starter-badge {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #fff; background: var(--blue); border-radius: 4px; padding: .1rem .4rem;
}

/* ---------- Scouting + matchup plans ---------- */
.card select { padding: .4rem; }
.photo-upload { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.photo-upload p { margin: .3rem 0 0; }
.matchup-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.matchup-head h2 { margin: 0; }

/* ---------- Lineup / projected XI ---------- */
.xi-row { display: flex; gap: .75rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.xi-row:last-child { border-bottom: 0; }
.xi-pos {
  flex: none; width: 5.5rem; font-family: "Oswald", sans-serif; font-weight: 600;
  color: var(--navy); text-transform: uppercase; font-size: .9rem; letter-spacing: .03em;
}
.xi-names { display: flex; flex-wrap: wrap; gap: .4rem; }
.xi-player { background: #eef4fb; border: 1px solid #cfe0f5; border-radius: 6px; padding: .15rem .5rem; }
.xi-empty { color: var(--muted); font-style: italic; padding: .15rem .3rem; }

/* "(idea for later)" — a parked, not-yet-built feature. Visibly future, not broken. */
.idea {
  display: inline-block; font-size: .8rem; font-style: italic; color: var(--muted);
  background: #eef1f5; border: 1px dashed var(--steel); border-radius: 999px; padding: .1rem .6rem;
}
h1 .idea { font-size: .95rem; vertical-align: middle; }
