/* ============================================================
   Teacher Amanda - Design System
   ============================================================ */
:root {
  --primary:      #FF6B35;
  --primary-dark: #e55a24;
  --sidebar-w:    240px;
  --k1:  #20c997; --k1-bg:  #d1fae5; --k1-text:  #065f46;
  --k2:  #0d6efd; --k2-bg:  #dbeafe; --k2-text:  #1e40af;
  --t1:  #6f42c1; --t1-bg:  #ede9fe; --t1-text:  #5b21b6;
  --bg:  #f0f2f5;
  --card-shadow: 0 1px 4px rgba(0,0,0,.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
  color: #212529;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 15px rgba(0,0,0,.2);
  transition: transform .3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  height: 72px;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
}

.topbar-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.sidebar-nav { flex: 1; padding: .75rem 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.5rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .93rem;
  transition: all .18s;
  position: relative;
  cursor: pointer;
}

.nav-item i { font-size: 1.1rem; }

.nav-item:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.05); }

.nav-item.active {
  color: #FF6B35;
  background: rgba(255,107,53,.12);
  border-right: 3px solid #FF6B35;
  font-weight: 600;
}

.badge-count {
  margin-left: auto;
  background: #FF6B35;
  color: white;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .45rem;
  min-width: 20px;
  text-align: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 2rem;
  min-height: 100vh;
}

/* ============================================================
   MOBILE
   ============================================================ */
.mobile-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #1a1a2e;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.btn-menu {
  background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; padding: .25rem;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: 1rem; padding-top: 70px; }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card-base {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* ============================================================
   STATS ROW (Dashboard)
   ============================================================ */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .82rem; color: #6c757d; margin-top: .2rem; }

@media (max-width: 600px) { .stats-row { grid-template-columns: 1fr; } }

/* ============================================================
   TODAY CLASS CARDS
   ============================================================ */
.today-card {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border-left: 5px solid var(--primary);
  text-decoration: none;
  color: inherit;
  margin-bottom: .75rem;
}

.today-card:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(0,0,0,.12); color: inherit; }
.today-card.completed { border-left-color: #28a745; opacity: .75; }
.today-card.cancelled { border-left-color: #dc3545; opacity: .55; }

.time-pill {
  background: #1a1a2e;
  color: white;
  padding: .4rem .75rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   LEVEL BADGES
   ============================================================ */
.level-badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.level-K1 { background: var(--k1-bg); color: var(--k1-text); }
.level-K2 { background: var(--k2-bg); color: var(--k2-text); }
.level-T1 { background: var(--t1-bg); color: var(--t1-text); }

/* ============================================================
   STUDENT CARDS
   ============================================================ */
.students-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

.student-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border-top: 4px solid transparent;
}

.student-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.student-card[data-level="K1"] { border-top-color: var(--k1); }
.student-card[data-level="K2"] { border-top-color: var(--k2); }
.student-card[data-level="T1"] { border-top-color: var(--t1); }

.student-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: .75rem;
}

/* ============================================================
   LESSON ROWS
   ============================================================ */
.lesson-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid #f0f2f5;
}

.lesson-row:hover { background: #f8f9fa; }

.lesson-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-scheduled { background: #ffc107; }
.dot-completed { background: #28a745; }
.dot-cancelled { background: #dc3545; }
.dot-trial     { background: #6c757d; }

/* ============================================================
   LESSON DETAIL
   ============================================================ */
.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s, transform .12s;
  cursor: pointer;
}

.resource-chip:hover { opacity: .85; transform: translateY(-1px); }
.resource-chip.video   { background: #fee2e2; color: #991b1b; }
.resource-chip.slides  { background: #fef3c7; color: #92400e; }
.resource-chip.game    { background: #d1fae5; color: #065f46; }
.resource-chip.book    { background: #dbeafe; color: #1e40af; }
.resource-chip.extra   { background: #f3e8ff; color: #7c3aed; }

.btn-complete {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  border-radius: 50px;
  padding: .85rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}

.btn-complete:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(40,167,69,.4); }
.btn-complete:disabled { opacity: .6; cursor: not-allowed; }

.btn-cancel-lesson {
  background: #f8d7da;
  color: #842029;
  border: none;
  border-radius: 50px;
  padding: .6rem 1.5rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

/* ============================================================
   SCHEDULE GRID
   ============================================================ */
.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: .85rem;
}

.schedule-table th {
  background: #1a1a2e;
  color: white;
  padding: .75rem .5rem;
  text-align: center;
  font-weight: 600;
  border-radius: 6px;
}

.schedule-table td {
  background: white;
  padding: .4rem .5rem;
  vertical-align: top;
  min-width: 80px;
  border-radius: 6px;
}

.schedule-table .time-col {
  background: #f8f9fa;
  color: #6c757d;
  font-weight: 600;
  text-align: center;
  width: 70px;
  font-size: .8rem;
}

.sched-chip {
  border-radius: 6px;
  padding: .3rem .5rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  margin: 1px 0;
  display: block;
}

/* ============================================================
   MATERIALS
   ============================================================ */
.materials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

.material-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.material-type-icon { font-size: 1.4rem; }

/* ============================================================
   REMINDERS
   ============================================================ */
.reminder-card {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #25D366;
  color: white;
  border: none;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-whatsapp:hover { opacity: .88; color: white; }
.btn-whatsapp.sent { background: #6c757d; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 8px; border: 1.5px solid #dee2e6; padding: .6rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(255,107,53,.2); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-custom {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: .55rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-primary-custom:hover { background: var(--primary-dark); color: white; }

.btn-ghost {
  background: none;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-weight: 500;
  cursor: pointer;
  color: #495057;
  transition: border-color .15s;
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-ghost:hover { border-color: #adb5bd; }

/* ============================================================
   COMPLETION ANIMATION
   ============================================================ */
@keyframes popIn {
  0%   { transform: scale(.5); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: popIn .35s ease forwards; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #495057;
  margin: 1.5rem 0 .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ============================================================
   CURRICULUM
   ============================================================ */
.curr-category {
  overflow: hidden;
  border-radius: 12px;
}

.curr-cat-header {
  background: #fff;
  transition: background .15s;
  user-select: none;
}

.curr-cat-header:hover {
  background: #f8f9fa;
}

.curr-lessons-body {
  background: #fff;
}

.curr-lesson-row {
  transition: background .12s;
}

.curr-lesson-row:hover {
  background: #f8f9fa !important;
}

.curr-lesson-row:last-child {
  border-bottom: none !important;
}

/* ============================================================
   FINANCEIRO — payment grid
   ============================================================ */
.financial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.financial-table th,
.financial-table td {
  padding: .5rem .6rem;
  border: 1px solid #e9ecef;
  vertical-align: middle;
}
.financial-table thead th {
  background: #f8f9fa;
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}
.financial-table tfoot td {
  background: #f0f4ff;
  border-top: 2px solid #dee2e6;
}
.financial-table tbody tr:hover td {
  filter: brightness(.97);
}

/* Payment cells */
.pkg-cell {
  cursor: pointer;
  text-align: center;
  transition: filter .12s, transform .1s;
  user-select: none;
}
.pkg-cell:hover {
  filter: brightness(.93);
  transform: scale(1.04);
  z-index: 1;
  position: relative;
}
.pkg-cell .pkg-value {
  font-weight: 700;
  font-size: .82rem;
  line-height: 1.2;
}
.pkg-cell .pkg-status-icon {
  font-size: .72rem;
  line-height: 1.4;
}
.pkg-empty {
  color: #d1d5db;
  font-size: 1.1rem;
}

/* Status colors */
.pkg-paid      { background: #d1fae5; color: #065f46; }
.pkg-partial   { background: #fef3c7; color: #92400e; }
.pkg-pending   { background: #f3f4f6; color: #6b7280; }
.pkg-overdue   { background: #fee2e2; color: #991b1b; }
.pkg-cancelled { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }

/* Student name column */
.pkg-student-name {
  font-size: .88rem;
  white-space: nowrap;
  background: #fff;
}

/* Legend chips */
.pkg-legend {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

/* ============================================================
   TOAST
   ============================================================ */
#appToast.bg-success { background: #28a745 !important; }
#appToast.bg-danger  { background: #dc3545 !important; }
#appToast.bg-primary { background: var(--primary) !important; }

/* ============================================================
   LOGIN
   ============================================================ */
#loginOverlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f8f0ff 0%, #fff5f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  height: 110px;
  width: auto;
  margin-bottom: 1rem;
  border-radius: 16px;
}

.login-subtitle {
  color: #6b7280;
  font-size: .9rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.login-box .form-control {
  border-radius: 10px;
  padding: .65rem 1rem;
}

.login-box .btn-primary {
  border-radius: 10px;
  padding: .65rem;
  font-size: 1rem;
}

/* ============================================================
   SIDEBAR USER FOOTER
   ============================================================ */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-logout {
  color: rgba(255,255,255,.6);
  font-size: .75rem;
  text-decoration: none;
  display: block;
  margin-top: 2px;
  transition: color .15s;
}
.sidebar-user-logout:hover { color: #fff; }
