/* =====================================================================
   Mill Creek Robotics Club — shared styles
   ===================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #16202c;
  --text-muted: #5c6b7a;
  --text-faint: #8a97a5;

  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8efff;

  --green: #059669;
  --green-soft: #e3f5ee;
  --amber: #d97706;
  --amber-soft: #fdf0dc;
  --red: #dc2626;
  --red-soft: #fdeaea;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 4px 12px rgba(16, 32, 48, 0.05);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #182027;
    --surface-2: #1f2932;
    --border: #2b3742;
    --text: #e8edf2;
    --text-muted: #9fb0c0;
    --text-faint: #758696;
    --brand: #5b8cff;
    --brand-dark: #4173e8;
    --brand-soft: #1c2c4d;
    --green-soft: #12301f;
    --amber-soft: #3a2a10;
    --red-soft: #3a1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 650; }
h1 { font-size: 1.85rem; letter-spacing: -0.02em; }
h2 { font-size: 1.3rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------- layout ------------------------------ */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 800;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }

main { padding: 28px 0 64px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head p { color: var(--text-muted); margin: 0; }

/* -------------------------------- cards ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* -------------------------------- stats ------------------------------ */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 650; margin-bottom: 6px;
}
.stat .value { font-size: 1.9rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat .sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.stat.attention { border-color: var(--amber); background: var(--amber-soft); }

/* ------------------------------- buttons ----------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 550;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(0.93); }
.btn-danger { background: var(--surface); border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------- forms ------------------------------ */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 5px;
}
.field .hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }

input[type='text'], input[type='email'], input[type='password'], input[type='number'],
input[type='date'], input[type='datetime-local'], input[type='color'], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 72px; }
input[type='color'] { padding: 2px; height: 36px; }

.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* -------------------------------- table ------------------------------ */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left; padding: 9px 10px;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint); font-weight: 650;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* -------------------------------- badges ----------------------------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-blue   { background: var(--brand-soft); color: var(--brand); }
.badge-green  { background: var(--green-soft); color: var(--green); }
.badge-amber  { background: var(--amber-soft); color: var(--amber); }
.badge-red    { background: var(--red-soft);   color: var(--red); }

.team-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 6px; vertical-align: baseline;
}

/* -------------------------------- tabs ------------------------------- */

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 14px;
  border: none; background: none;
  font: inherit; font-size: 0.92rem; font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 999px; font-size: 0.72rem;
  background: var(--surface-2); color: var(--text-muted);
}
.tab.active .count { background: var(--brand-soft); color: var(--brand); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* -------------------------------- chat ------------------------------- */

.chat-window {
  height: 420px;
  overflow-y: auto;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg { display: flex; gap: 10px; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.msg-body { flex: 1; min-width: 0; }
.msg-meta { font-size: 0.78rem; color: var(--text-faint); margin-bottom: 2px; }
.msg-meta strong { color: var(--text); font-weight: 650; }
.msg-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.deleted .msg-text { color: var(--text-faint); font-style: italic; }
.chat-composer { display: flex; gap: 8px; margin-top: 12px; }
.chat-composer textarea { min-height: 44px; max-height: 140px; }

/* ------------------------------- gallery ----------------------------- */

.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo .meta { padding: 8px 10px; font-size: 0.8rem; }
.photo .meta .caption { color: var(--text); }
.photo .meta .who { color: var(--text-faint); font-size: 0.75rem; margin-top: 2px; }

/* ------------------------------ utilities ---------------------------- */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 0.85rem; }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.85rem; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inline-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
}

/* ------------------------------- notices ----------------------------- */

.notice {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.notice-error { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.notice-success { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.notice-info { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

/* -------------------------------- modal ------------------------------ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 32, 48, 0.45);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
}
.modal h2 { margin-top: 0; }

/* -------------------------------- auth ------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

/* -------------------------------- hero ------------------------------- */

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff;
  padding: 56px 0;
  margin-bottom: 32px;
}
.hero h1 { color: #fff; font-size: 2.4rem; max-width: 20ch; }
.hero p { color: rgba(255, 255, 255, 0.9); font-size: 1.08rem; max-width: 56ch; margin-bottom: 0; }

/* Copy on the left, illustration on the right; stacks on narrow screens. */
.hero-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.hero-copy { flex: 1 1 360px; min-width: 0; }
.hero-art {
  flex: 0 1 380px;
  width: 100%;
  max-width: 380px;
  height: auto;
  display: block;
}
/* A dropped-in photo gets framed rather than stretched. Landscape on wide
   screens, portrait on phones — matching the two files you can supply. */
img.hero-art {
  border-radius: var(--radius);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
@media (max-width: 820px) {
  img.hero-art { aspect-ratio: 3 / 4; max-width: 300px; }
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.team-card h3 { margin-bottom: 4px; }
.team-card .meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }
.team-card p { font-size: 0.9rem; color: var(--text-muted); flex: 1; }

/* ------------------------------ calendar ----------------------------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-head {
  background: var(--surface-2);
  padding: 7px 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.cal-day {
  background: var(--surface);
  min-height: 92px;
  padding: 5px 6px;
  font-size: 0.8rem;
}
.cal-day.other { background: var(--surface-2); color: var(--text-faint); }
.cal-day.today .cal-num {
  background: var(--brand); color: #fff;
  border-radius: 50%; width: 21px; height: 21px;
  display: grid; place-items: center;
}
.cal-num { font-weight: 650; margin-bottom: 4px; font-size: 0.78rem; }
.cal-event {
  font-size: 0.72rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

@media (max-width: 820px) {
  /* Anything laid out as an explicit two-column grid collapses to one. */
  .grid[style*='grid-template-columns'] { grid-template-columns: 1fr !important; }
}

@media (max-width: 820px) {
  .hero-inner { gap: 20px; }
  .hero-art { max-width: 320px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .hero { padding: 40px 0; }
  .hero h1 { font-size: 1.8rem; }
  .hero-art { max-width: 260px; }
  .cal-day { min-height: 62px; }
  .chat-window { height: 340px; }
}
