/* Araya Teacher Portal — restyled to match the Preskool-style admin shell. */

:root {
  --ink: #10201b;
  --muted: #55645f;
  --paper: #fbfcf7;
  --white: #ffffff;
  --soft: #edf5ef;
  --line: #d8e4dc;
  --green: #064f35;
  --green-2: #0b6f4a;
  --amber: #f39a18;
  --coral: #c95b43;
  --shadow: 0 18px 54px rgba(16, 32, 27, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.5; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
h1 { margin: 0; line-height: 1.15; }

/* ---------- Header ---------- */

.portal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--green);
}
.brand img { width: 120px; height: auto; filter: brightness(0) invert(1); }

.portal-header strong {
  display: block;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-2);
}
.portal-header span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.portal-header span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

/* ---------- Shell ---------- */

.portal-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 20px;
  width: min(1320px, calc(100% - 48px));
  margin: 24px auto 48px;
  align-items: start;
}

.portal-menu {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--green);
  position: sticky;
  top: 92px;
}

.portal-menu button {
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.portal-menu button:hover { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.portal-menu button.active { background: var(--white); color: var(--green); }

.workspace { min-width: 0; }

/* ---------- Panels ---------- */

.panel {
  display: none;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel.active { display: grid; gap: 18px; }
.panel-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; flex-wrap: wrap; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 { font-size: 1.4rem; }

.session-controls,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label { display: grid; gap: 6px; color: var(--ink); font-weight: 700; font-size: 0.85rem; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-weight: 400;
  font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-2); outline-offset: 1px; }

textarea { resize: vertical; }
select:disabled { color: var(--muted); background: var(--soft); }

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.roll-table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 0.85rem; }

.roll-table th,
.roll-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.roll-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.roll-table tbody tr:hover { background: var(--soft); }
.roll-table tbody tr:last-child td { border-bottom: 0; }
.student-name { min-width: 160px; font-weight: 700; }

/* ---------- Buttons / status ---------- */

.primary-action {
  min-height: 44px;
  padding: 11px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--amber);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  justify-self: start;
}
.primary-action:hover { filter: brightness(1.05); }

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--green-2);
  font-weight: 600;
  font-size: 0.85rem;
}
.form-status.error { color: var(--coral); }

@media (max-width: 860px) {
  .portal-shell { grid-template-columns: 1fr; width: min(720px, calc(100% - 32px)); }
  .portal-menu { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .session-controls, .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .portal-header { padding: 14px 16px; }
  .portal-shell { margin: 18px auto 32px; }
}

/* ---------- Dashboard ---------- */

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft);
  padding: 18px; display: flex; flex-direction: column; gap: 4px;
}
.dash-card h2 { margin: 0; font-size: 1.15rem; }
.dash-card > p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.dash-card-session { background: var(--green); color: var(--white); }
.dash-card-session .eyebrow, .dash-card-session > p { color: rgba(255, 255, 255, 0.85); }
.dash-card-session h2 { color: var(--white); }
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-link {
  border: 0; background: none; color: var(--green-2); font-weight: 700; font-size: 0.82rem;
  cursor: pointer; padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.homework-stats { display: flex; gap: 20px; margin-top: 8px; }
.homework-stats > div { display: flex; flex-direction: column; gap: 2px; }
.homework-stats strong { font-size: 1.6rem; line-height: 1; color: var(--green-2); }
.homework-stats span { font-size: 0.78rem; color: var(--muted); }
.homework-stats .stat-bad strong { color: var(--coral); }
.attention-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.attention-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.attention-row strong { font-size: 0.9rem; }
.attention-reason { font-size: 0.76rem; font-weight: 700; color: var(--coral); text-transform: uppercase; letter-spacing: 0.03em; }
.attention-row small { color: var(--muted); font-size: 0.8rem; }

@media (max-width: 640px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ---------- Documents ---------- */

.documents-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.documents-grid .card-panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
  box-shadow: var(--shadow); padding: 18px;
}
.documents-grid h3 { margin: 0 0 12px; font-size: 1rem; }
.data-list { display: flex; flex-direction: column; gap: 10px; }
.data-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--soft); border-radius: var(--radius-sm); font-size: 0.85rem;
}
.data-row strong { display: block; font-size: 0.86rem; }
.data-row small { color: var(--muted); }
.data-row a { color: var(--green-2); font-weight: 700; font-size: 0.82rem; white-space: nowrap; }

@media (max-width: 640px) {
  .documents-grid { grid-template-columns: 1fr; }
}

/* ---------- Login ---------- */

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px; display: flex; flex-direction: column; gap: 12px;
}
.login-card .brand-plain { align-self: flex-start; margin-bottom: 8px; }
.login-card .brand-plain img { height: 34px; width: auto; }
.login-card h1 { font-size: 1.3rem; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 700; }
.login-card input {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem;
  font-weight: 400; background: var(--paper); color: var(--ink);
}
.small-note { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.hero-message-alert {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--amber); color: var(--ink); font-weight: 800; font-size: 0.82rem;
  padding: 8px 14px; border-radius: 999px;
}
.hero-message-alert:hover { filter: brightness(1.05); }
.logout-action {
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.logout-action:hover { border-color: var(--green-2); color: var(--green-2); }

/* ---------- Messages ---------- */

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--amber); color: var(--ink);
  font-size: 0.7rem; font-weight: 800; margin-left: 4px;
}
.messages-panel.active { display: flex; flex-direction: column; }

.messages-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: stretch; }
.message-sidebar {
  display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); box-shadow: var(--shadow); padding: 16px;
}
.new-message-row { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.contact-search { position: relative; }
.contact-search input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; font-size: 0.85rem;
  background: var(--paper); color: var(--ink);
}
.contact-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; padding: 4px;
}
.contact-search-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; color: var(--ink); font-weight: 400;
}
.contact-search-item:hover { background: var(--soft); }
.contact-search-empty { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.thread-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 50vh; }
.thread-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; text-align: left; background: transparent; width: 100%;
}
.thread-item:hover { background: var(--soft); }
.thread-item.active { background: var(--soft); border-color: var(--green-2); }
.thread-item strong { display: block; font-size: 0.86rem; }
.thread-role {
  display: inline-block; margin-left: 6px; font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  color: var(--green-2); background: var(--soft); border-radius: 999px; padding: 1px 6px; vertical-align: middle;
}
.thread-item small { color: var(--muted); font-size: 0.76rem; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.thread-unread {
  flex: 0 0 auto; background: var(--amber); color: var(--ink); font-size: 0.68rem; font-weight: 800;
  border-radius: 999px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

.message-panel {
  display: flex; flex-direction: column; min-height: 50vh; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); box-shadow: var(--shadow); padding: 16px;
}
.message-panel-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.message-panel-head h3 { font-size: 1rem; margin: 0; }
.message-thread {
  flex: 1; min-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px;
}
.message-bubble { max-width: 70%; padding: 9px 12px; border-radius: 12px; font-size: 0.85rem; background: var(--soft); }
.message-bubble small { display: block; color: var(--muted); font-size: 0.7rem; margin-top: 4px; }
.message-bubble.from-self { align-self: flex-end; background: var(--green); color: var(--white); }
.message-bubble.from-self small { color: rgba(255, 255, 255, 0.7); }
.message-compose { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.message-compose textarea {
  flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 0.85rem;
  background: var(--paper); color: var(--ink); resize: vertical;
}

@media (max-width: 860px) {
  .messages-layout { grid-template-columns: 1fr; }
}
