/* css/app.css — Because of Song Music School */

:root {
  --bos-primary:   #6C3FC7;
  --bos-secondary: #F5A623;
  --bos-success:   #28A745;
  --bos-bg:        #F8F7FF;
  --bos-sidebar:   #1E1340;
  --bos-sidebar-w: 240px;
}

/* ── Base ───────────────────────────────────────────── */
body { background: var(--bos-bg); font-family: 'Segoe UI', Sarabun, sans-serif; }

/* ── Sidebar Layout ─────────────────────────────────── */
#sidebar {
  width: var(--bos-sidebar-w);
  min-height: 100vh;
  background: var(--bos-sidebar);
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
#sidebar .brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
#sidebar .brand h1 { font-size: 1rem; font-weight: 700; color: #fff; margin: 0; }
#sidebar .brand small { color: var(--bos-secondary); font-size: .75rem; }
#sidebar .nav-link {
  color: rgba(255,255,255,.7);
  padding: .6rem 1rem;
  border-radius: 8px;
  margin: 2px 8px;
  display: flex; align-items: center; gap: .5rem;
  transition: background .15s, color .15s;
}
#sidebar .nav-link:hover,
#sidebar .nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
#sidebar .nav-link i { font-size: 1.1rem; width: 1.4rem; text-align: center; }

#mainContent {
  margin-left: var(--bos-sidebar-w);
  min-height: 100vh;
  padding: 1.5rem;
}

.nav-label {
  color: rgba(255,255,255,.45);
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .85rem 1.1rem .25rem;
}
.nav-badge {
  margin-left: auto;
  background: var(--bos-secondary);
  color: #1E1340;
  border-radius: 99px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .35rem;
  font-size: .7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Mobile sidebar — overlay only while the menu is open */
@media (max-width: 767.98px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.show { transform: translateX(0); }
  #mainContent { margin-left: 0; }
}
#overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
#overlay.show { display: block; }

/* ── Topbar ─────────────────────────────────────────── */
#topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: .75rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 50;
  margin: -1.5rem -1.5rem 1.5rem;
}
#topbar .page-title { font-weight: 700; font-size: 1.1rem; margin: 0; flex: 1; }

/* ── Page sections ──────────────────────────────────── */
.page-section { display: none; }
.page-section.active { display: block; }

/* ── Cards ──────────────────────────────────────────── */
.card { border: none; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-radius: 12px; }
.card-header { background: #fff; border-bottom: 1px solid #f0f0f0; font-weight: 600; }
.stat-card {
  border-radius: 12px;
  background: #fff;
  color: var(--bos-sidebar);
  border: 1px solid #eceaf3;
  padding: 1.1rem 1.25rem;
  position: relative;
}
.stat-card .stat-label { color: #6b7280; font-size: .8rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-card.accent {
  background: var(--bos-secondary);
  border-color: var(--bos-secondary);
  color: #1E1340;
}
.stat-card.accent .stat-label { color: rgba(30,19,64,.75); }

.bos-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
  background: var(--bos-sidebar);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 10px;
  max-width: min(360px, calc(100vw - 2rem));
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.bos-toast.show { opacity: 1; transform: none; }

.today-card { border-left: 4px solid var(--bos-secondary); }
.att-btn.active, .record-btn.active { background: var(--bos-primary); color: #fff; border-color: var(--bos-primary); }
.record-fact { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid rgba(30,19,64,.08); }
.record-fact b { font-weight: 600; text-align: right; }
.piece-meter { height: 8px; background: rgba(30,19,64,.08); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.piece-meter span { display: block; height: 100%; background: var(--bos-primary); }

/* ── Timetable Grid ─────────────────────────────────── */
.timetable-grid { overflow-x: auto; }
.timetable-grid table { min-width: 700px; border-collapse: collapse; }
.timetable-grid th {
  background: var(--bos-sidebar);
  color: #fff;
  text-align: center;
  padding: .5rem;
  font-size: .85rem;
  white-space: nowrap;
}
.timetable-grid td {
  border: 1px solid #e5e7eb;
  vertical-align: top;
  padding: 4px;
  min-width: 90px;
  min-height: 60px;
  background: #fff;
}
.timetable-cell {
  background: #EDE9FC;
  border-left: 3px solid var(--bos-primary);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: .78rem;
  margin-bottom: 2px;
  cursor: pointer;
}
.timetable-cell .student-name { font-weight: 600; }
.timetable-cell .instrument   { color: #6c757d; }
.timetable-cell.substitute    { background: #FFF3CD; border-left-color: var(--bos-secondary); }

/* ── Audio Player ───────────────────────────────────── */
.track-card {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: .75rem 1rem;
  background: #fff;
  transition: box-shadow .15s;
}
.track-card:hover { box-shadow: 0 2px 8px rgba(108,63,199,.15); }
.track-card audio { width: 100%; margin-top: .5rem; }
.level-badge { font-size: .7rem; padding: 3px 8px; border-radius: 20px; }
.level-beginner    { background: #D4EDDA; color: #155724; }
.level-intermediate{ background: #FFF3CD; color: #856404; }
.level-advanced    { background: #F8D7DA; color: #721C24; }

/* ── Lesson Note ────────────────────────────────────── */
.note-raw     { background: #f8f9fa; border-left: 3px solid #adb5bd; padding: .75rem; border-radius: 4px; font-size: .9rem; white-space: pre-wrap; }
.note-polished { background: #F0F9F4; border-left: 3px solid var(--bos-success); padding: .75rem; border-radius: 4px; font-size: .9rem; line-height: 1.7; }

/* ── Misc ───────────────────────────────────────────── */
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bos-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.avatar-photo {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; background: #efeaf8;
}
.avatar-circle.lg, .avatar-photo.lg { width: 64px; height: 64px; }
.avatar-circle.lg { font-size: 1.4rem; }
.avatar-circle.sm, .avatar-photo.sm { width: 28px; height: 28px; font-size: .75rem; }
.btn-primary   { background: var(--bos-primary); border-color: var(--bos-primary); }
.btn-primary:hover { background: #5b34a8; border-color: #5b34a8; }

/* ── Counter QR poster ──────────────────────────────── */
.counter-poster {
  width: min(100%, 420px);
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(30,19,64,.12);
  border-radius: 16px;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  color: var(--bos-sidebar);
}
.counter-poster .poster-mark { font-size: 2.4rem; line-height: 1; }
.counter-poster .poster-school { font-size: 1.35rem; font-weight: 700; margin-top: .35rem; }
.counter-poster .poster-sub { color: var(--bos-secondary); font-weight: 600; letter-spacing: .04em; }
.counter-poster h2 { font-size: 1.15rem; margin: 1rem 0 .75rem; }
.counter-poster #qrBox svg { width: min(100%, 280px); height: auto; }
.counter-poster ol { text-align: left; margin: 1rem auto 0; max-width: 320px; padding-left: 1.2rem; }
.counter-poster li { margin: .35rem 0; }
.counter-poster .poster-url { margin-top: 1rem; font-size: .8rem; color: #6c6578; word-break: break-all; }
@media print {
  body.printing-poster { background: #fff; }
  body.printing-poster #sidebar,
  body.printing-poster #overlay,
  body.printing-poster #topbar,
  body.printing-poster .no-print { display: none !important; }
  body.printing-poster #mainContent { margin: 0; padding: 0; }
  body.printing-poster .counter-poster { border: none; box-shadow: none; width: 100%; }
}

/* Loading spinner overlay */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
