/* ─── EduTrack Teacher Portal ─────────────────────────────── */

:root {

  --tp-primary:    #4f46e5;

  --tp-primary-dk: #3730a3;

  --tp-accent:     #06b6d4;

  --tp-success:    #16a34a;

  --tp-warning:    #d97706;

  --tp-danger:     #dc2626;

  --tp-bg:         #f8f9fc;

  --tp-card:       #ffffff;

  --tp-text:       #1e293b;

  --tp-muted:      #64748b;

  --tp-border:     #e2e8f0;

  --tp-nav-h:      64px;

  --tp-nav-safe:   calc(64px + env(safe-area-inset-bottom, 0px));

}



*, *::before, *::after { box-sizing: border-box; }



html, body {

  margin: 0; padding: 0;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  background: var(--tp-bg);

  color: var(--tp-text);

  font-size: 15px;

  line-height: 1.5;

  overscroll-behavior: none;

}



/* ─── Shell ─────────────────────────────────────────────────── */

#tp-shell {

  display: flex;

  flex-direction: column;

  min-height: 100dvh;

}



#tp-header {

  position: sticky; top: 0; z-index: 100;

  background: var(--tp-primary);

  color: #fff;

  padding: 0 1rem;

  height: 56px;

  display: flex; align-items: center; justify-content: space-between;

  box-shadow: 0 1px 4px rgba(0,0,0,.15);

}

#tp-header h1 {

  font-size: 1.1rem; font-weight: 600; margin: 0;

}

#tp-header .tp-header-actions { display: flex; gap: .5rem; align-items: center; }

.tp-avatar {

  width: 32px; height: 32px; border-radius: 50%;

  background: rgba(255,255,255,.2);

  display: flex; align-items: center; justify-content: center;

  font-size: .85rem; font-weight: 600; color: #fff;

  cursor: pointer;

}



#tp-main {

  flex: 1;

  padding-bottom: var(--tp-nav-safe);

  overflow-y: auto;

  -webkit-overflow-scrolling: touch;

}



/* ─── Tabs / Sections ────────────────────────────────────────── */

.tp-section { display: none; padding: 1rem; }

.tp-section.active { display: block; }



/* ─── Bottom Nav ─────────────────────────────────────────────── */

#tp-nav {

  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;

  background: var(--tp-card);

  border-top: 1px solid var(--tp-border);

  display: flex; height: var(--tp-nav-h);

  padding-bottom: env(safe-area-inset-bottom, 0px);

  box-shadow: 0 -2px 8px rgba(0,0,0,.06);

}

.tp-nav-btn {

  flex: 1; display: flex; flex-direction: column;

  align-items: center; justify-content: center;

  gap: 3px; border: none; background: none;

  cursor: pointer; padding: 6px 2px;

  color: var(--tp-muted); font-size: .65rem;

  transition: color .15s;

  position: relative;

}

.tp-nav-btn i { font-size: 1.15rem; }

.tp-nav-btn.active { color: var(--tp-primary); }

.tp-nav-btn.active i { font-weight: 900; }

.tp-badge {

  position: absolute; top: 4px; right: calc(50% - 14px);

  background: var(--tp-danger); color: #fff;

  font-size: .55rem; font-weight: 700;

  min-width: 16px; height: 16px;

  border-radius: 99px; padding: 0 4px;

  display: flex; align-items: center; justify-content: center;

  display: none;

}

.tp-badge.show { display: flex; }



/* ─── Cards ──────────────────────────────────────────────────── */

.tp-card {

  background: var(--tp-card);

  border-radius: 12px;

  box-shadow: 0 1px 4px rgba(0,0,0,.07);

  padding: 1rem;

  margin-bottom: .75rem;

}

.tp-card-title {

  font-size: .8rem; font-weight: 600; color: var(--tp-muted);

  text-transform: uppercase; letter-spacing: .04em;

  margin-bottom: .6rem;

}

.tp-card-title .badge { vertical-align: middle; }



/* ─── Today ───────────────────────────────────────────────────── */

.tp-date-banner {

  background: linear-gradient(135deg, var(--tp-primary) 0%, var(--tp-primary-dk) 100%);

  color: #fff; border-radius: 14px;

  padding: 1.1rem 1.2rem;

  margin-bottom: 1rem;

}

.tp-date-banner .day  { font-size: 1rem; opacity: .85; margin-bottom: 2px; }

.tp-date-banner .date { font-size: 1.3rem; font-weight: 700; }

.tp-date-banner .stats { display: flex; gap: 1.5rem; margin-top: .8rem; }

.tp-date-banner .stat-val { font-size: 1.6rem; font-weight: 700; }

.tp-date-banner .stat-lbl { font-size: .7rem; opacity: .8; }



.tp-slot-row {

  display: flex; align-items: center; gap: .75rem;

  padding: .55rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-slot-row:last-child { border-bottom: none; }

.tp-slot-time { font-size: .75rem; color: var(--tp-muted); min-width: 85px; }

.tp-slot-info { flex: 1; }

.tp-slot-info .subj { font-weight: 600; font-size: .9rem; }

.tp-slot-info .cls  { font-size: .78rem; color: var(--tp-muted); }

.tp-slot-dot {

  width: 10px; height: 10px; border-radius: 50%;

  background: var(--tp-border);

  flex-shrink: 0;

}

.tp-slot-dot.active   { background: var(--tp-success); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }

.tp-slot-dot.done     { background: var(--tp-muted); }

.tp-slot-dot.next     { background: var(--tp-warning); }

.tp-slot-dot.break    { background: var(--tp-accent); }

.slot-badge-active  { background: #dcfce7; color: #16a34a; }

.slot-badge-next    { background: #fef3c7; color: #92400e; }

.slot-badge-done    { background: #f1f5f9; color: #64748b; }

.slot-badge-break   { background: #cffafe; color: #0e7490; }



/* ─── Timetable ──────────────────────────────────────────────── */

.tp-day-pills {

  display: flex; gap: .4rem; overflow-x: auto;

  margin-bottom: .8rem; padding-bottom: 2px;

}

.tp-day-pill {

  border: none; background: var(--tp-border);

  border-radius: 99px; padding: .35rem .9rem;

  font-size: .8rem; cursor: pointer; white-space: nowrap;

  transition: background .15s, color .15s;

}

.tp-day-pill.active {

  background: var(--tp-primary); color: #fff; font-weight: 600;

}

.tp-tt-slot {

  display: flex; align-items: center; gap: .75rem;

  padding: .6rem .8rem; border-radius: 10px;

  margin-bottom: .4rem; background: #f8fafc;

  border: 1px solid var(--tp-border);

}

.tp-tt-slot.today-slot { border-color: var(--tp-primary); background: #eef2ff; }

.tp-tt-slot.is-break   { background: #f0fdf4; border-color: #bbf7d0; }

.tp-tt-time { font-size: .75rem; color: var(--tp-muted); min-width: 85px; }

.tp-tt-body { flex: 1; }

.tp-tt-body .subj  { font-weight: 600; }

.tp-tt-body .meta  { font-size: .78rem; color: var(--tp-muted); }



/* ─── Attendance ─────────────────────────────────────────────── */

.tp-controls {

  display: flex; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap;

}

.tp-controls select, .tp-controls input {

  flex: 1; min-width: 120px;

  border: 1px solid var(--tp-border); border-radius: 8px;

  padding: .45rem .75rem; font-size: .85rem;

  background: var(--tp-card); color: var(--tp-text);

}

.tp-student-row {

  display: flex; align-items: center; gap: .6rem;

  padding: .5rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-student-row:last-child { border-bottom: none; }

.tp-avatar-sm {

  width: 36px; height: 36px; border-radius: 50%;

  object-fit: cover; flex-shrink: 0;

}

.tp-student-name { flex: 1; font-size: .88rem; font-weight: 500; }

.tp-att-btns { display: flex; gap: 4px; }

.tp-att-btn {

  width: 32px; height: 32px; border-radius: 8px;

  border: 1.5px solid var(--tp-border);

  background: none; font-size: .7rem; font-weight: 700;

  cursor: pointer; transition: all .12s;

  color: var(--tp-muted);

}

.tp-att-btn:hover { border-color: #94a3b8; }

.tp-att-btn.sel-P { background: #dcfce7; border-color: #16a34a; color: #15803d; }

.tp-att-btn.sel-A { background: #fee2e2; border-color: #dc2626; color: #b91c1c; }

.tp-att-btn.sel-L { background: #fef3c7; border-color: #d97706; color: #92400e; }

.tp-att-btn.sel-E { background: #e0e7ff; border-color: #4f46e5; color: #3730a3; }



/* ─── Marks ──────────────────────────────────────────────────── */

.tp-marks-row {

  display: grid; grid-template-columns: 1fr 80px 80px 70px;

  gap: .4rem; align-items: center;

  padding: .45rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-marks-row:last-child { border-bottom: none; }

.tp-marks-hdr {

  font-size: .72rem; font-weight: 700; color: var(--tp-muted);

  text-transform: uppercase;

}

.tp-score-input {

  border: 1px solid var(--tp-border); border-radius: 6px;

  padding: .3rem .4rem; font-size: .88rem; text-align: center;

  width: 100%; background: #fff;

}

.tp-score-input:focus { outline: none; border-color: var(--tp-primary); }

.tp-grade-badge {

  font-size: .75rem; font-weight: 700;

  padding: 2px 6px; border-radius: 6px;

  background: #f1f5f9; color: var(--tp-muted);

  text-align: center;

}



/* ─── Lesson Plans / Notes ─────────────────────────────────── */

.tp-plan-row {

  display: flex; align-items: flex-start; gap: .75rem;

  padding: .65rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-plan-row:last-child { border-bottom: none; }

.tp-plan-body { flex: 1; }

.tp-plan-title { font-weight: 600; font-size: .9rem; }

.tp-plan-meta  { font-size: .78rem; color: var(--tp-muted); }

.tp-plan-actions { display: flex; gap: .4rem; flex-shrink: 0; }

.tp-icon-btn {

  width: 32px; height: 32px;

  border-radius: 8px; border: 1px solid var(--tp-border);

  background: none; cursor: pointer;

  display: flex; align-items: center; justify-content: center;

  color: var(--tp-muted); font-size: .85rem;

  transition: all .12s;

}

.tp-icon-btn:hover { border-color: var(--tp-primary); color: var(--tp-primary); }



/* ─── Homework ────────────────────────────────────────────────── */

.tp-hw-row {

  padding: .65rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-hw-row:last-child { border-bottom: none; }

.tp-hw-title { font-weight: 600; }

.tp-hw-meta  { font-size: .78rem; color: var(--tp-muted); }

.tp-progress-bar {

  height: 6px; border-radius: 99px;

  background: var(--tp-border); margin-top: 6px; overflow: hidden;

}

.tp-progress-fill {

  height: 100%; border-radius: 99px;

  background: var(--tp-success); transition: width .3s;

}



/* ─── My Class ────────────────────────────────────────────────── */

.tp-student-card {

  display: flex; align-items: center; gap: .75rem;

  padding: .55rem 0;

  border-bottom: 1px solid var(--tp-border);

  cursor: pointer;

}

.tp-student-card:last-child { border-bottom: none; }

.tp-student-card img {

  width: 42px; height: 42px;

  border-radius: 50%; object-fit: cover; flex-shrink: 0;

}

.tp-student-info { flex: 1; }

.tp-student-info .name { font-weight: 600; font-size: .9rem; }

.tp-student-info .meta { font-size: .76rem; color: var(--tp-muted); }

.tp-att-pill {

  font-size: .72rem; font-weight: 600; padding: 3px 8px;

  border-radius: 99px;

}

.att-high { background: #dcfce7; color: #166534; }

.att-mid  { background: #fef9c3; color: #854d0e; }

.att-low  { background: #fee2e2; color: #991b1b; }



/* ─── Notices ────────────────────────────────────────────────── */

.tp-notice-row {

  padding: .7rem 0;

  border-bottom: 1px solid var(--tp-border);

}

.tp-notice-row:last-child { border-bottom: none; }

.tp-notice-title { font-weight: 600; margin-bottom: 3px; }

.tp-notice-body  { font-size: .85rem; color: var(--tp-muted); }

.tp-notice-date  { font-size: .72rem; color: #94a3b8; margin-top: 4px; }



/* ─── More Drawer ────────────────────────────────────────────── */

#tp-more-backdrop {

  position: fixed; inset: 0; background: rgba(0,0,0,.35);

  z-index: 300; display: none;

}

#tp-more-backdrop.open { display: block; }

#tp-more-drawer {

  position: fixed; bottom: 0; left: 0; right: 0;

  background: var(--tp-card); border-radius: 16px 16px 0 0;

  z-index: 400; padding: 1rem;

  transform: translateY(100%);

  transition: transform .25s cubic-bezier(.32,.72,0,1);

  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));

}

#tp-more-drawer.open { transform: translateY(0); }

.tp-drawer-grip {

  width: 40px; height: 4px; border-radius: 99px;

  background: var(--tp-border); margin: 0 auto 1rem;

}

.tp-drawer-grid {

  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem;

}

.tp-drawer-item {

  display: flex; flex-direction: column; align-items: center;

  gap: .4rem; padding: .75rem .5rem;

  border-radius: 12px; border: none;

  background: #f8fafc; cursor: pointer;

  font-size: .78rem; color: var(--tp-text); font-weight: 500;

  transition: background .15s;

}

.tp-drawer-item:hover { background: #eef2ff; }

.tp-drawer-item i { font-size: 1.4rem; color: var(--tp-primary); }



/* ─── Modal (form sheet) ─────────────────────────────────────── */

.tp-modal-backdrop {

  position: fixed; inset: 0; background: rgba(0,0,0,.4);

  z-index: 500; display: none; align-items: flex-end;

}

.tp-modal-backdrop.open { display: flex; }

.tp-modal-sheet {

  background: var(--tp-card);

  border-radius: 16px 16px 0 0;

  width: 100%; max-height: 92dvh;

  overflow-y: auto;

  padding: 1.2rem 1rem;

  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));

  animation: slideUp .25s cubic-bezier(.32,.72,0,1);

}

@keyframes slideUp {

  from { transform: translateY(100%); }

  to   { transform: translateY(0); }

}

.tp-modal-header {

  display: flex; align-items: center; justify-content: space-between;

  margin-bottom: 1rem;

}

.tp-modal-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }

.tp-modal-close {

  border: none; background: none; font-size: 1.3rem;

  color: var(--tp-muted); cursor: pointer; line-height: 1;

}

.tp-form-group { margin-bottom: .8rem; }

.tp-label { font-size: .8rem; font-weight: 600; color: var(--tp-muted); margin-bottom: 4px; display: block; }

.tp-input, .tp-select, .tp-textarea {

  width: 100%; border: 1px solid var(--tp-border);

  border-radius: 8px; padding: .5rem .75rem;

  font-size: .9rem; color: var(--tp-text);

  background: var(--tp-card); transition: border-color .15s;

}

.tp-input:focus, .tp-select:focus, .tp-textarea:focus {

  outline: none; border-color: var(--tp-primary);

}

.tp-textarea { min-height: 80px; resize: vertical; }

.tp-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }



/* ─── Buttons ─────────────────────────────────────────────────── */

.tp-btn {

  display: inline-flex; align-items: center; justify-content: center;

  gap: .4rem; border: none; border-radius: 10px;

  padding: .6rem 1.2rem; font-size: .88rem; font-weight: 600;

  cursor: pointer; transition: all .15s;

}

.tp-btn-primary {

  background: var(--tp-primary); color: #fff;

}

.tp-btn-primary:hover { background: var(--tp-primary-dk); }

.tp-btn-outline {

  background: none; border: 1.5px solid var(--tp-border);

  color: var(--tp-text);

}

.tp-btn-outline:hover { border-color: var(--tp-primary); color: var(--tp-primary); }

.tp-btn-sm { padding: .4rem .85rem; font-size: .8rem; border-radius: 8px; }

.tp-btn-danger { background: #fee2e2; color: var(--tp-danger); }

.tp-btn-block { width: 100%; }

.tp-fab {

  position: fixed; bottom: calc(var(--tp-nav-safe) + 1rem); right: 1rem;

  width: 52px; height: 52px; border-radius: 50%;

  background: var(--tp-primary); color: #fff;

  border: none; box-shadow: 0 4px 14px rgba(79,70,229,.4);

  font-size: 1.4rem; cursor: pointer; z-index: 150;

  display: flex; align-items: center; justify-content: center;

  display: none;

}

.tp-fab.show { display: flex; }



/* ─── Utilities ──────────────────────────────────────────────── */

.tp-empty {

  text-align: center; padding: 2.5rem 1rem;

  color: var(--tp-muted); font-size: .9rem;

}

.tp-empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .3; }

.tp-spinner {

  width: 36px; height: 36px; border-radius: 50%;

  border: 3px solid var(--tp-border);

  border-top-color: var(--tp-primary);

  animation: spin .6s linear infinite;

  margin: 2rem auto;

}

@keyframes spin { to { transform: rotate(360deg); } }

.tp-loading { display: flex; justify-content: center; padding: 2rem; }

.tp-toast {

  position: fixed; bottom: calc(var(--tp-nav-safe) + .5rem); left: 50%;

  transform: translateX(-50%) translateY(12px);

  background: #1e293b; color: #fff;

  padding: .55rem 1.2rem; border-radius: 99px;

  font-size: .85rem; font-weight: 500;

  z-index: 9999; opacity: 0;

  transition: opacity .2s, transform .2s;

  pointer-events: none; white-space: nowrap;

}

.tp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tp-toast.tp-toast-success { background: #16a34a; }

.tp-toast.tp-toast-error   { background: #dc2626; }



/* ─── Auth page ──────────────────────────────────────────────── */

.tp-auth-wrap {

  min-height: 100dvh; display: flex; flex-direction: column;

  align-items: center; justify-content: center;

  padding: 1.5rem; background: var(--tp-bg);

}

.tp-auth-card {

  background: var(--tp-card); border-radius: 16px;

  padding: 2rem 1.5rem; width: 100%; max-width: 380px;

  box-shadow: 0 4px 24px rgba(0,0,0,.08);

}

.tp-auth-logo {

  width: 64px; height: 64px; border-radius: 16px;

  background: var(--tp-primary); color: #fff;

  display: flex; align-items: center; justify-content: center;

  font-size: 2rem; margin: 0 auto 1.2rem;

}

.tp-auth-title { text-align: center; font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }

.tp-auth-sub   { text-align: center; font-size: .85rem; color: var(--tp-muted); margin-bottom: 1.5rem; }



/* ─── Offline banner ─────────────────────────────────────────── */

#tp-offline-banner {

  background: #fef3c7; color: #92400e;

  text-align: center; font-size: .8rem; padding: 4px;

  display: none;

}

#tp-offline-banner.show { display: block; }



/* ─── Scrollbar suppression on mobile ───────────────────────── */

.tp-scroll-x { overflow-x: auto; scrollbar-width: none; }

.tp-scroll-x::-webkit-scrollbar { display: none; }



/* ─── Status badges ──────────────────────────────────────────── */

.badge-draft     { background: #f1f5f9; color: #475569; }

.badge-submitted { background: #fef3c7; color: #92400e; }

.badge-approved  { background: #dcfce7; color: #166534; }

.badge-active    { background: #dcfce7; color: #166534; }

.badge-closed    { background: #f1f5f9; color: #475569; }



/* ─── Engagement indicator ───────────────────────────────────── */

.eng-excellent { color: #16a34a; }

.eng-good      { color: #0ea5e9; }

.eng-fair      { color: #d97706; }

.eng-poor      { color: #dc2626; }



/* ─── Install prompt ─────────────────────────────────────────── */

#tp-install-bar {

  background: var(--tp-primary); color: #fff;

  display: flex; align-items: center; justify-content: space-between;

  padding: .6rem 1rem; gap: .5rem; display: none;

}

#tp-install-bar.show { display: flex; }

#tp-install-bar span { font-size: .82rem; flex: 1; }

#tp-install-bar button {

  border: 1.5px solid rgba(255,255,255,.6);

  background: none; color: #fff; border-radius: 6px;

  padding: .2rem .7rem; font-size: .78rem; cursor: pointer;

}



/* ─── Student Support / Interventions ───────────────────────── */

.tp-tier-tab {

  padding: .3rem .8rem; border-radius: 99px; font-size: .78rem;

  font-weight: 600; border: 1.5px solid #e2e8f0;

  background: #fff; color: #475569; cursor: pointer; white-space: nowrap;

  display: flex; align-items: center; gap: .3rem;

  transition: background .15s, color .15s, border-color .15s;

}

.tp-tier-tab.active { background: var(--tp-primary); color: #fff; border-color: var(--tp-primary); }

.int-dot {

  display: inline-block; width: 8px; height: 8px; border-radius: 50%;

}

.int-dot.critical { background: #dc2626; }

.int-dot.atrisk   { background: #d97706; }

.int-dot.monitor  { background: #2563eb; }



@media (min-width: 600px) {

  #tp-main { max-width: 640px; margin: 0 auto; }

  #tp-nav  { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 0; }

}

