/* Omar's College Application Tracker — clean, minimal, Linear/Notion-inspired */

:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f8;
  --border: #e4e4e7;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --gray-bg: #f4f4f5;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ---------- Auth screen ---------- */
#auth-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 16px; padding: 24px; text-align: center;
}
#auth-screen h1 { font-size: 22px; font-weight: 650; }
#auth-screen p { color: var(--text-secondary); max-width: 420px; }
.btn-google {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff; border: none;
  padding: 10px 22px; border-radius: var(--radius); font-weight: 550; font-size: 15px;
}
.btn-google:hover { background: #000; }
.auth-error { color: var(--red); font-weight: 550; }
.demo-note {
  margin-top: 8px; font-size: 12.5px; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 14px;
}

/* ---------- App shell ---------- */
#app { display: none; min-height: 100vh; }
#app.visible { display: block; }

header.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 52px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand .cycle { color: var(--text-muted); font-weight: 500; font-size: 12px; margin-left: 6px; }

nav.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
nav.tabs button {
  background: none; border: none; padding: 8px 12px; border-radius: 6px;
  color: var(--text-secondary); font-weight: 500; white-space: nowrap;
}
nav.tabs button:hover { background: var(--bg-subtle); color: var(--text); }
nav.tabs button.active { background: var(--gray-bg); color: var(--text); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-email { color: var(--text-muted); font-size: 12.5px; }
.demo-badge {
  background: var(--amber-bg); color: var(--amber); border: 1px solid #fcd34d;
  font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; letter-spacing: .03em;
}
.btn-signout { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; color: var(--text-secondary); }
.btn-signout:hover { background: var(--bg-subtle); }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- Generic UI ---------- */
.view-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-header h2 { font-size: 19px; font-weight: 650; }

.btn {
  background: var(--accent); color: #fff; border: none;
  padding: 7px 14px; border-radius: 6px; font-weight: 550;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid var(--border); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-link { background: none; border: none; color: var(--accent); padding: 2px 4px; font-size: 12.5px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: var(--gray-bg); color: var(--text-secondary); }
.badge-blue { background: #eef2ff; color: var(--accent); }

.deadline-red { color: var(--red); font-weight: 600; }
.deadline-amber { color: var(--amber); font-weight: 600; }
.deadline-green { color: var(--green); }
.deadline-gray { color: var(--text-muted); }

/* metric cards */
.metric-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.metric-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.metric-card .value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.metric-card .value.alert { color: var(--red); }
.metric-card .label { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }

/* tables */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--bg-subtle); white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-subtle); }
tr.row-overdue { background: var(--red-bg); }
tr.row-overdue:hover { background: #fde8e8; }
tr.row-soon { background: var(--amber-bg); }
tr.row-soon:hover { background: #fdf3d7; }
.school-link { font-weight: 600; color: var(--text); cursor: pointer; }
.school-link:hover { color: var(--accent); text-decoration: underline; }
.empty { padding: 36px; text-align: center; color: var(--text-muted); }

/* progress bar */
.progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.progress .bar { flex: 1; height: 5px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; }
.progress .fill { height: 100%; border-radius: 99px; }
.progress .pct { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }

/* filter bar */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar select, .filter-bar input {
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--text);
}
.filter-bar label { font-size: 12px; color: var(--text-muted); }

/* follow-ups panel */
.followups {
  background: var(--amber-bg); border: 1px solid #fcd34d; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 22px;
}
.followups h3 { font-size: 13.5px; font-weight: 650; color: var(--amber); margin-bottom: 8px; }
.followups ul { list-style: none; }
.followups li { padding: 5px 0; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.followups .due { font-weight: 600; color: var(--amber); }

/* school detail */
.detail-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-header h2 { font-size: 21px; font-weight: 700; }
.detail-meta { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn-back { background: none; border: none; color: var(--text-secondary); padding: 0; margin-bottom: 12px; font-size: 13px; }
.btn-back:hover { color: var(--text); }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.subtabs button {
  background: none; border: none; padding: 8px 14px; color: var(--text-secondary);
  font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtabs button.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }

/* recommender cards */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.rec-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); position: relative;
}
.rec-card.urgent { border-color: var(--red); }
.rec-card .urgent-dot {
  position: absolute; top: 14px; right: 14px; width: 10px; height: 10px;
  background: var(--red); border-radius: 99px;
}
.rec-card h4 { font-size: 15px; font-weight: 650; margin-bottom: 2px; }
.rec-card .role { color: var(--text-secondary); font-size: 12.5px; margin-bottom: 10px; }
.rec-card .row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; gap: 10px; }
.rec-card .row .k { color: var(--text-muted); }
.rec-card .actions { margin-top: 10px; display: flex; gap: 6px; }

/* modal */
#modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 100; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
}
#modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; padding: 24px; margin-bottom: 5vh;
}
.modal h3 { font-size: 17px; font-weight: 650; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-field input, .form-field select, .form-field textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px;
  font-family: inherit; font-size: 13.5px; color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-field textarea { resize: vertical; min-height: 64px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* toast / errors */
#toast {
  display: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13.5px; z-index: 200; box-shadow: var(--shadow-lg); max-width: 90vw;
}
#toast.show { display: block; }
#toast.error { background: var(--red); }
#toast button { background: none; border: none; color: #fff; text-decoration: underline; margin-left: 10px; }

/* loading */
#loading {
  display: none; position: fixed; inset: 0; background: rgba(255,255,255,.7);
  z-index: 150; align-items: center; justify-content: center; font-weight: 600; color: var(--text-secondary);
}
#loading.show { display: flex; }

.checkbox-cell input { width: 16px; height: 16px; cursor: pointer; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .metric-cards { grid-template-columns: repeat(2, 1fr); }
  header.topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  nav.tabs { order: 3; width: 100%; }
  .user-email { display: none; }
  main { padding: 16px 12px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  td, th { padding: 8px 10px; }
}
