:root {
  --navy: #12213a;
  --navy-light: #1c3157;
  --accent: #2f6fed;
  --accent-dark: #1f4fc4;
  --gold: #d9a441;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b2436;
  --text-muted: #5c6781;
  --border: #e3e7f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(18, 33, 58, 0.08);
}

* { box-sizing: border-box; min-width: 0; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
  flex-wrap: wrap;
  row-gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
}
.brand .logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold);
}
.nav-links { display: flex; gap: 24px; font-size: 0.95rem; color: #cfd8ec; flex-wrap: wrap; row-gap: 8px; }
.nav-links a:hover { color: #fff; }

.login-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.35); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-ghost { background: rgba(255,255,255,0.08); color: #fff; }
.btn-danger { background: #e2544a; color: #fff; }
.btn-secondary { background: #eef1f8; color: var(--navy); }
.btn-secondary:hover { background: #e2e7f3; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, #24406e 100%);
  color: #fff;
  padding: 56px 0 64px;
}
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); margin: 0 0 16px; max-width: 720px; line-height: 1.25; }
.hero p.lead { font-size: 1.05rem; color: #d3dcf1; max-width: 620px; margin: 0 0 30px; }
.hero .hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.badge-row { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.badge {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #e8edfa;
}

/* Sections */
section { padding: 48px 0; }
.section-title { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 0 0 10px; color: var(--navy); }
.section-subtitle { color: var(--text-muted); max-width: 640px; margin: 0 0 32px; }

/* About cards */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.about-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .12s ease, box-shadow .12s ease;
}
.about-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(18, 33, 58, 0.12); }
.about-card .icon { font-size: 1.8rem; margin-bottom: 12px; }
.about-card h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--navy); }
.about-card p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }

/* Team */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 26px;
}
.team-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.team-card .photo-wrap {
  aspect-ratio: 4/5;
  overflow: hidden;
  background: #dfe4ee;
}
.team-card .photo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  font-size: 3rem;
  font-weight: 800;
}
.team-card .info { padding: 18px 20px 22px; }
.team-card h3 { margin: 0 0 4px; font-size: 1.1rem; color: var(--navy); }
.team-card .subject { color: var(--accent); font-size: 0.88rem; font-weight: 600; margin-bottom: 8px; }
.team-card .price {
  margin-top: 12px;
  display: inline-block;
  background: #eef3ff;
  color: var(--accent-dark);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Pricing */
.pricing-box {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  border-radius: var(--radius);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.pricing-box .price-figure { font-size: 2.6rem; font-weight: 800; }
.pricing-box .price-figure span { font-size: 1.1rem; font-weight: 500; color: #cdd8f0; }
.pricing-box ul { margin: 10px 0 0; padding-left: 20px; color: #d7e0f5; font-size: 0.92rem; }

/* Login section on homepage */
.login-section { background: #fff; border-top: 1px solid var(--border); }
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}
.role-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: box-shadow .15s ease, transform .15s ease;
  background: var(--bg);
}
.role-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.role-card .role-icon { font-size: 1.9rem; margin-bottom: 10px; }
.role-card h4 { margin: 0 0 6px; color: var(--navy); }
.role-card p { margin: 0 0 16px; font-size: 0.85rem; color: var(--text-muted); }

/* Footer */
.site-footer {
  background: var(--navy);
  color: #b9c4de;
  padding: 30px 0;
  font-size: 0.85rem;
  text-align: center;
}

/* Auth page */
.auth-wrap {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.auth-card h2 { margin: 0 0 6px; color: var(--navy); }
.auth-card p.hint { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fbfcfe;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.error-msg {
  background: #fdeceb;
  color: #b3352b;
  border: 1px solid #f6c5c0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }
.demo-note {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #f6f8fc;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.6;
}

/* Dashboard layout */
.dash-header {
  background: var(--navy);
  color: #fff;
}
.dash-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-wrap: wrap;
  row-gap: 10px;
}
.dash-header .who { font-size: 0.85rem; color: #cfd8ec; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dash-header .who strong { color: #fff; }

.dash-body { display: flex; min-height: calc(100vh - 68px); max-width: 100vw; }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 22px 16px;
}
.sidebar h4 { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; margin: 6px 10px 12px; }
.sidebar-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
  margin-bottom: 4px;
}
.sidebar-item:hover { background: #f0f3fa; }
.sidebar-item.active { background: #e8effe; color: var(--accent-dark); font-weight: 600; }

.main-panel { flex: 1; padding: 28px 32px; max-width: 1000px; min-width: 0; }
.panel-title { font-size: 1.4rem; margin: 0 0 4px; color: var(--navy); }
.panel-subtitle { color: var(--text-muted); margin: 0 0 24px; font-size: 0.92rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 1.05rem; color: var(--navy); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.pill-admin { background: #fdeee0; color: #b0620c; }
.pill-teacher { background: #e7f0ff; color: #1f5fd6; }
.pill-student { background: #e6f7ee; color: #158a53; }
.pill-parent { background: #f3e9fe; color: #7a3fc4; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }

.empty-state { color: var(--text-muted); font-size: 0.9rem; padding: 10px 0; }

.two-col { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 20px; }

/* ---- Responsive breakpoints ---- */

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .dash-body { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .main-panel { padding: 22px 20px; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero { padding: 44px 0 52px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  section { padding: 40px 0; }
  .pricing-box { padding: 28px 22px; flex-direction: column; align-items: flex-start; }
  .pricing-box .btn { width: 100%; }
  .auth-card { padding: 28px 22px; }
  .main-panel { padding: 18px 14px; }
  .card { padding: 18px 16px; }
  .hw-item { padding: 12px 14px; }
  .edit-form, .submission-form { padding: 12px; }
  .form-row { flex-direction: column; }
  .form-row .field { min-width: 0; }
  .brand { font-size: 1rem; }
}

/* Tables become horizontally scrollable on narrow screens instead of squeezing/breaking */
@media (max-width: 700px) {
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s ease;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b3352b; }

/* Calendar widget */
.cal-nav { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.cal-header { text-align: center; margin-bottom: 10px; color: var(--navy); font-size: 1rem; }
.cal-weekdays, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-weekdays { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 6px; text-align: center; }
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #f4f6fb;
  color: var(--text);
}
.cal-cell.cal-empty { background: transparent; }
.cal-cell.cal-conducted { background: #d7f2e3; color: #157a4c; font-weight: 700; }
.cal-cell.cal-scheduled { background: #fdead0; color: #a8660a; font-weight: 700; }
.cal-legend { display: flex; gap: 18px; margin-top: 14px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.cal-dot-conducted { background: #2fae72; }
.cal-dot-scheduled { background: #e6a43a; }

/* Lesson status badges + editable toggles */
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.status-yes { background: #e6f7ee; color: #158a53; }
.status-no { background: #fdeceb; color: #b3352b; }
.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}
.status-toggle input { cursor: pointer; }
.status-toggle.on { background: #e6f7ee; border-color: #bfe9d3; color: #158a53; }
.status-toggle.off { background: #fdeceb; border-color: #f6c5c0; color: #b3352b; }

/* Free-trial badge on teacher cards */
.trial-badge {
  display: inline-block;
  margin-top: 10px;
  background: #eafaf0;
  color: #158a53;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}
.price-tiers { margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.85rem; }
.price-tiers li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); color: var(--text-muted); }
.price-tiers li:last-child { border-bottom: none; }
.price-tiers li span:last-child { color: var(--navy); font-weight: 700; }

/* Grade stats summary */
.stats-row { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.stat-box {
  flex: 1;
  min-width: 160px;
  background: #f4f6fb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
}
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Homework photo thumbnails */
.photo-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .12s ease;
}
.photo-thumb:hover { transform: scale(1.06); }
.pdf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 64px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fef6ea;
  color: #a8660a;
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Unpaid lessons indicator */
.unpaid-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2544a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.unpaid-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.unpaid-banner.has-unpaid { background: #fdeceb; color: #b3352b; border: 1px solid #f6c5c0; }
.unpaid-banner.all-paid { background: #e6f7ee; color: #158a53; border: 1px solid #bfe9d3; }

/* Homework / materials / submission items (shared by teacher, student, parent views) */
.hw-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: #fbfcfe;
}
.hw-item:last-child { margin-bottom: 0; }
.hw-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 6px;
}
.hw-item-head h4 { margin: 0; font-size: 1rem; color: var(--navy); word-break: break-word; }
.hw-item-head > div { flex-wrap: wrap; }
.hw-due {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #eef1f8;
  padding: 4px 10px;
  border-radius: 999px;
}
.hw-desc { margin: 6px 0; font-size: 0.9rem; color: var(--text); word-break: break-word; }
.hw-teacher { margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }

.hw-submission {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.hw-submission h5 { margin: 0 0 8px; font-size: 0.85rem; color: var(--navy); text-transform: uppercase; letter-spacing: .03em; }
.submission-existing {
  background: #f4f6fb;
  border-radius: 8px;
  padding: 12px 14px;
}
.submission-existing p { margin: 0 0 8px; font-size: 0.9rem; word-break: break-word; }
.submission-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

.edit-form, .submission-form {
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: #f4f6fb;
  border: 1px solid var(--border);
}
.edit-form .field, .submission-form .field { margin-bottom: 12px; }
.edit-form .field:last-of-type, .submission-form .field:last-of-type { margin-bottom: 14px; }

/* Photo/PDF preview items with an optional delete button in the corner */
.photo-preview-item { position: relative; display: inline-block; }
.photo-del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #e2544a;
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-del-btn:hover { background: #c94036; }
.field input[type="file"] {
  padding: 8px 10px;
  background: #fbfcfe;
}
