/* ClassLine OS -- glassmorphism theme */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- ClassLine brand ----------
   The identity is dark-first: near-black navy, with a single signature
   gradient running purple -> blue -> cyan -> green. Those four stops are the
   brand; everything else borrows from them. */

:root {
  --brand-purple: #8b3df0;
  --brand-blue:   #2b8bff;
  --brand-cyan:   #0bc0dd;
  --brand-green:  #16d989;
  --brand-gradient: linear-gradient(120deg, var(--brand-purple), var(--brand-blue) 42%, var(--brand-cyan) 68%, var(--brand-green));

  /* Dark is the default -- it is how the brand is drawn. */
  --bg: #060a14;
  --bg-gradient: radial-gradient(circle at 12% -5%, rgba(139, 61, 240, 0.20), transparent 48%),
                 radial-gradient(circle at 88% 12%, rgba(22, 217, 137, 0.13), transparent 46%),
                 #060a14;
  --text-main: #f2f5fb;
  --text-muted: #8f9bb3;
  --card-bg: rgba(255, 255, 255, 0.045);
  --glass-border: rgba(255, 255, 255, 0.10);
  --desk-header-bg: rgba(255, 255, 255, 0.045);
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.45);

  /* Per-school accents default to the brand, then get overridden by the
     school's own colours at runtime. */
  --school-primary: #7c5cff;
  --school-primary-glow: rgba(124, 92, 255, 0.24);
  --school-secondary: #16d989;
  --school-secondary-glow: rgba(22, 217, 137, 0.22);
  --electric-green: #16d989;
  --accent-blue: #2b8bff;
  --accent-warning: #f5a524;
  --accent-danger: #f4436c;
}

body.light-theme {
  --bg: #eef1fa;
  --bg-gradient: radial-gradient(circle at 15% 0%, rgba(139, 61, 240, 0.10), transparent 45%),
                 radial-gradient(circle at 85% 20%, rgba(22, 217, 137, 0.09), transparent 45%), #eef1fa;
  --text-main: #0d1120;
  --text-muted: #5f6880;
  --card-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(10, 14, 30, 0.09);
  --desk-header-bg: rgba(10, 14, 30, 0.04);
  --shadow: 0 10px 30px rgba(20, 20, 50, 0.10);
  --accent-warning: #d97706;
  --accent-danger: #e11d48;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, .brand-title, .modal-head span { font-family: 'Outfit', sans-serif; }

button, input, select, textarea { font-family: inherit; }

img { max-width: 100%; }

/* ---------- top menu bar ---------- */

.macos-menu-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 1.5rem;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.82rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.macos-menu-left, .macos-menu-right { display: flex; align-items: center; gap: 1.1rem; }

.macos-menu-item { color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.macos-menu-item:hover { color: var(--text-main); }

.menu-logo { height: 22px; width: 22px; border-radius: 6px; vertical-align: middle; margin-right: 4px; }

.popia-audit-badge, .macos-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.15);
  color: #059669;
  cursor: pointer;
}

#current-user-badge {
  font-weight: 700;
  color: var(--text-main);
  background: var(--school-primary-glow);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------- navbar ---------- */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem 2rem;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 44px; width: 44px; }
.brand-title { font-weight: 900; font-size: 1.2rem; letter-spacing: -0.01em; }

/* "Class" stays solid, "Line" carries the gradient -- as drawn in the identity. */
.wordmark-line {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tagline {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.brand-tag { font-size: 0.75rem; font-weight: 700; color: var(--school-primary); background: var(--school-primary-glow); padding: 3px 10px; border-radius: 999px; }

.role-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.role-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.15s ease;
}

.role-btn:hover { color: var(--text-main); }

.role-btn.active {
  background: var(--school-primary);
  border-color: var(--school-primary);
  color: #fff;
  box-shadow: 0 6px 18px var(--school-primary-glow);
}

.badge-count {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.72rem;
}

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

.container { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem 4rem; }

.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

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

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-weight: 800;
  font-size: 1.02rem;
  margin-bottom: 1.1rem;
}

.stat-card { display: flex; align-items: center; gap: 14px; margin-bottom: 0; }
.stat-icon { font-size: 1.4rem; width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--desk-header-bg); }
.stat-icon.green { background: rgba(5, 150, 105, 0.15); }
.stat-icon.purple { background: var(--school-primary-glow); }
.stat-icon.pink { background: rgba(225, 29, 72, 0.12); }
.stat-value { font-size: 1.5rem; font-weight: 900; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* ---------- notices & feature panels ---------- */

.notice-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.notice-green { background: rgba(5, 150, 105, 0.08); border: 1px solid rgba(5, 150, 105, 0.3); }
.notice-warning { background: rgba(245, 165, 36, 0.1); border: 1px solid rgba(245, 165, 36, 0.35); color: var(--text-main); font-weight: 600; }

.feature-panel { padding: 1rem; border-radius: 16px; margin-bottom: 1.25rem; }
.feature-purple { background: rgba(124, 58, 237, 0.08); border: 1px solid var(--school-primary-glow); }
.feature-blue { background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.3); }
.feature-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 800; font-size: 0.9rem; flex-wrap: wrap; gap: 8px; }
.feature-panel-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }

/* ---------- buttons & pills ---------- */

.btn {
  border: none;
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--desk-header-bg);
  color: var(--text-main);
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }

.btn-electric-green { background: var(--electric-green); color: #05170f; }
.btn-purple { background: var(--school-primary); color: #fff; }
.btn-warning { background: var(--accent-warning); color: #241800; }
.btn-danger { background: var(--accent-danger); color: #fff; }

.desk-btn { flex: 1; padding: 4px; font-size: 0.75rem; font-weight: 800; border-radius: 8px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.pill-green { background: rgba(5, 150, 105, 0.15); color: #059669; }
.pill-purple { background: var(--school-primary-glow); color: var(--school-primary); }
.pill-warning { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.pill-danger { background: rgba(239, 68, 68, 0.18); color: #dc2626; }

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

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--desk-header-bg);
  color: var(--text-main);
  font-size: 0.88rem;
}
.form-control:focus { outline: 2px solid var(--school-primary); outline-offset: 1px; }

/* ---------- tables ---------- */

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--glass-border); }
.table td { padding: 10px; border-bottom: 1px solid var(--glass-border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

/* ---------- classroom floor plan ---------- */

.classroom-floor-plan { border: 1px solid var(--glass-border); border-radius: 18px; padding: 1.25rem; background: var(--desk-header-bg); margin-top: 1rem; }
.classroom-wall-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 10px; flex-wrap: wrap; }
.classroom-window-indicator, .classroom-door-indicator { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.classroom-blackboard { background: #123524; color: #fff; padding: 10px 20px; border-radius: 10px; text-align: center; flex: 1; margin: 0 12px; }
.chalk-text { font-family: 'Outfit', sans-serif; font-weight: 800; letter-spacing: 0.5px; }
.teacher-stage-area { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.teacher-wooden-desk { background: rgba(146, 92, 41, 0.18); border: 1px solid rgba(146, 92, 41, 0.35); padding: 8px 20px; border-radius: 10px; font-size: 0.8rem; font-weight: 700; }

.seating-row { margin-bottom: 1.25rem; }
.row-label { font-size: 0.8rem; font-weight: 800; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.row-desks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.desk-card { background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 14px; padding: 12px; }

/* ---------- WhatsApp phone simulator ---------- */

.wa-container { display: flex; justify-content: center; }

.phone-shell {
  width: 100%; max-width: 380px;
  background: #0c0a17;
  border-radius: 32px;
  padding: 10px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  height: 640px;
  border: 6px solid #1a1730;
}

.phone-notch { width: 100px; height: 18px; background: #1a1730; border-radius: 0 0 14px 14px; margin: 0 auto 6px; }

.wa-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.wa-school-info { display: flex; align-items: center; gap: 10px; }
.wa-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--school-primary-glow); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.wa-school-name { color: #fff; font-weight: 800; font-size: 0.9rem; }
.wa-verified { color: #38bdf8; }
.wa-status { color: #94a3b8; font-size: 0.72rem; }

.wa-filter-bar { display: flex; gap: 6px; padding: 6px 8px; overflow-x: auto; }
.wa-chip { background: rgba(255,255,255,0.06); color: #cbd5e1; border: none; border-radius: 999px; padding: 5px 11px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.wa-chip.active { background: var(--electric-green); color: #05170f; }

.wa-chat-body { flex: 1; overflow-y: auto; padding: 10px; background: #131022; display: flex; flex-direction: column; gap: 10px; }
.wa-date-divider { text-align: center; color: #64748b; font-size: 0.68rem; font-weight: 700; margin-bottom: 4px; }

.wa-bubble { background: #1c1830; border-radius: 12px; padding: 10px 12px; max-width: 92%; align-self: flex-start; color: #e5e7eb; font-size: 0.82rem; }
.wa-bubble.outgoing { align-self: flex-end; background: #16532e; }
.wa-bubble.urgent { border: 1px solid rgba(239, 68, 68, 0.5); }

.wa-bubble-header { display: flex; justify-content: space-between; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.4px; color: #94a3b8; margin-bottom: 6px; }
.wa-tag-finance { color: #fbbf24; }
.wa-tag-marks { color: #38bdf8; }
.wa-tag-discipline { color: #f87171; }
.wa-tag-attendance { color: #34d399; }
.wa-tag-enrollment { color: #a78bfa; }
.wa-tag-curriculum { color: #60a5fa; }

.wa-bubble-content { line-height: 1.45; white-space: pre-line; }
.wa-bubble-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wa-action-btn { background: rgba(255,255,255,0.08); color: #e5e7eb; border: none; border-radius: 8px; padding: 6px 10px; font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.wa-bubble-footer { display: flex; justify-content: flex-end; gap: 4px; margin-top: 6px; font-size: 0.65rem; color: #64748b; }
.wa-ticks { color: #38bdf8; }

.wa-parent-menu { padding: 8px 12px; background: #0c0a17; border-top: 1px solid rgba(255,255,255,0.08); display: flex; gap: 6px; overflow-x: auto; align-items: center; }

.wa-input-bar { padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.wa-mock-input { flex: 1; background: rgba(255,255,255,0.06); color: #94a3b8; border-radius: 999px; padding: 8px 14px; font-size: 0.8rem; }
.wa-real-input {
  flex: 1; background: rgba(255,255,255,0.06); color: #e5e7eb; border: none;
  border-radius: 999px; padding: 9px 14px; font-size: 0.8rem; outline: none;
}
.wa-real-input::placeholder { color: #64748b; }
.wa-send-btn { color: #94a3b8; }

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

.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 5, 15, 0.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem;
}
.modal-card { width: 100%; max-width: 460px; background: var(--card-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: 22px; padding: 1.5rem; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 1.05rem; margin-bottom: 1.1rem; }
.modal-close { background: transparent; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 1rem; }

/* ---------- toast ---------- */

#toast-banner {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #f9fafb; padding: 12px 22px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 3000; max-width: 90vw; text-align: center;
}
#toast-banner.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- licence suspension banner ---------- */

.licence-banner {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
  color: #fff;
  padding: 10px 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 200;
}

/* ---------- setup wizard ---------- */

.wizard-steps { display: flex; gap: 6px; margin-bottom: 1.5rem; }
.wizard-step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-align: center;
}
.wizard-step span {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--desk-header-bg); border: 1px solid var(--glass-border);
  font-size: 0.75rem;
}
.wizard-step.active { color: var(--school-primary); }
.wizard-step.active span { background: var(--school-primary); color: #fff; border-color: var(--school-primary); }
.wizard-step.done span { background: var(--electric-green); color: #05170f; border-color: var(--electric-green); }

.wizard-page { display: none; }
.wizard-page.active { display: block; animation: fadeIn 0.2s ease; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; gap: 10px; }

.field-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- parent <-> teacher message threads ---------- */

.thread-list { display: flex; flex-direction: column; gap: 10px; }
.thread-card { border: 1px solid var(--glass-border); border-radius: 14px; padding: 12px; background: var(--desk-header-bg); }
.thread-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.85rem; font-weight: 800; }
.thread-msgs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 220px; overflow-y: auto; }
.thread-msg { padding: 7px 11px; border-radius: 10px; font-size: 0.8rem; max-width: 85%; line-height: 1.4; }
.thread-msg.parent { background: rgba(255,255,255,0.07); align-self: flex-start; }
.thread-msg.staff { background: var(--school-primary); color: #fff; align-self: flex-end; }
.thread-msg .meta { display: block; font-size: 0.65rem; opacity: 0.7; margin-top: 3px; }
.thread-reply { display: flex; gap: 6px; }
.thread-reply input { flex: 1; }
.unread-dot { background: var(--accent-danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 0.68rem; font-weight: 800; }

/* ---------- fair play badge ---------- */

.fairplay-bar { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; }
.fairplay-bar strong { color: var(--text-main); }

/* ---------- auth pages (login / invite) ---------- */

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-shell { padding: 1rem; width: 100%; }
.auth-card {
  max-width: 420px; margin: 0 auto;
  background: var(--card-bg); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius: 24px;
  padding: 2rem; box-shadow: var(--shadow);
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin-bottom: 1.75rem; text-align: center;
}
.auth-brand img { height: 74px; width: 74px; margin-bottom: 2px; }
.auth-brand .auth-wordmark { font-family: 'Outfit', sans-serif; font-weight: 900; font-size: 1.9rem; letter-spacing: -0.02em; line-height: 1; }
.auth-brand .brand-tagline { font-size: 0.6rem; letter-spacing: 0.24em; }

/* Brand rule: a hairline of the gradient, as under the wordmark in the identity */
.brand-rule {
  height: 2px; width: 100%; max-width: 220px; border-radius: 2px;
  background: var(--brand-gradient); opacity: 0.85; margin: 4px auto 0;
}

/* Feature strip from the identity artwork */
.brand-features {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 14px 18px;
  margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--glass-border);
}
.brand-feature {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 0.56rem; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700; width: 62px; text-align: center;
}
.brand-feature svg { width: 21px; height: 21px; stroke-width: 1.9; fill: none; }
.auth-card h1 { font-size: 1.35rem; margin: 0 0 4px; }
.auth-sub { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 1.25rem; }
.auth-error { color: var(--accent-danger); font-size: 0.8rem; min-height: 1.1em; margin-bottom: 8px; }
