
:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #0d9488;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s;
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 18px; color: #fff; margin-top: 4px; }
.sidebar-subtitle { font-size: 11px; color: #64748b; margin-top: 2px; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 14px; border: none; background: none;
  color: var(--sidebar-text); font-size: 14px; cursor: pointer;
  border-radius: 8px; margin-bottom: 2px; transition: all 0.15s;
  font-family: inherit; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-badge { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-name { font-size: 13px; color: #e2e8f0; }
.btn-login { width: 100%; padding: 10px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13px; }
.btn-login:hover { background: var(--primary-dark); }

/* ===== MAIN ===== */
.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 20px; }
.topbar-spacer { flex: 1; }
.menu-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }

.content { flex: 1; padding: 24px; max-width: 1200px; width: 100%; }

/* ===== BOTTOM NAV ===== */
.bottom-nav { display: none; }

/* ===== DASHBOARD ===== */
.dash-hero { background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%); color: #fff; padding: 28px 32px; border-radius: var(--radius); margin-bottom: 20px; }
.dash-hero h2 { font-family: "Plus Jakarta Sans", sans-serif; font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.dash-hero p { opacity: 0.85; font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-family: "Plus Jakarta Sans", sans-serif; font-size: 32px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.dash-actions h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.empty-hint { margin-top: 20px; padding: 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; text-align: center; }
.empty-hint p { margin-bottom: 10px; color: #92400e; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-desc { color: var(--text-muted); font-size: 13px; max-width: 500px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.action-cell { white-space: nowrap; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; background: #f1f5f9; color: #475569; font-weight: 500; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-orange { background: #fef3c7; color: #92400e; }

/* ===== BUTTONS ===== */
.btn { padding: 9px 18px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1f5f9; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 12px; border: none; border-radius: 6px; cursor: pointer; font-family: inherit; font-weight: 600; }
.btn-edit { background: #f1f5f9; color: #334155; }
.btn-edit:hover { background: #e2e8f0; }
.btn-sm.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm.btn-danger:hover { background: #fecaca; }
.btn-add { background: #ecfdf5; color: #065f46; width: 100%; margin-top: 10px; padding: 8px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* ===== ASSIGNMENTS ===== */
.assignment-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.assign-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.assign-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.assign-card-header h3 { font-family: "Plus Jakarta Sans", sans-serif; font-size: 18px; }
.assign-count { font-size: 12px; color: var(--text-muted); background: #f1f5f9; padding: 3px 10px; border-radius: 20px; }
.assign-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.assign-table th { text-align: left; padding: 6px 8px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.assign-table td { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; }
.missing-subjects { margin-top: 8px; padding: 8px; background: #fffbeb; border-radius: 6px; font-size: 12px; }
.missing-label { color: #92400e; font-weight: 600; margin-right: 4px; }
.all-assigned { margin-top: 8px; padding: 6px; color: #166534; font-size: 13px; font-weight: 500; }

/* ===== SCHEDULE ===== */
.schedule-mode-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.mode-tab { padding: 10px 20px; border: none; background: none; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.conflict-cell { border: 2px solid #dc2626 !important; }
.conflict-details { margin-top: 20px; }
.conflict-details h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: #dc2626; }
.conflict-list { display: flex; flex-direction: column; gap: 8px; }
.conflict-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; font-size: 13px; }
.conflict-day { font-weight: 700; color: #dc2626; min-width: 40px; }
.conflict-time { color: var(--text-muted); min-width: 50px; }
.conflict-classes { font-weight: 600; color: #991b1b; }
.schedule-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.control-group { display: flex; align-items: center; gap: 8px; }
.control-group label { font-size: 13px; font-weight: 600; }
.control-group select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--surface); }
.control-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.schedule-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.schedule-grid { width: 100%; border-collapse: collapse; min-width: 600px; }
.schedule-grid th { padding: 10px 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid var(--border); background: #f8fafc; text-transform: uppercase; letter-spacing: 0.5px; }
.time-col { width: 70px; min-width: 70px; }
.schedule-grid td { border: 1px solid #f1f5f9; padding: 0; height: 58px; vertical-align: top; }
.time-col { background: #f8fafc; padding: 6px 8px; text-align: center; }
.time-label { font-size: 12px; font-weight: 700; color: var(--text); }
.time-end { display: none; }

.sched-cell { cursor: pointer; transition: background 0.1s; position: relative; }
.sched-cell.filled { padding: 6px 8px; }
.sched-cell.filled:hover { filter: brightness(0.96); }
.sched-cell.empty:hover { background: #f0fdfa; }
.sched-cell.dim-cell { background: #f8fafc; opacity: 0.5; }
.sched-cell.dim-cell:hover { background: #f1f5f9; opacity: 0.7; }
.lesson-subj { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.lesson-teacher { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-cell.empty:hover .plus-icon { color: var(--primary); }
.sched-cell.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: #f0fdfa !important; }
.sched-cell.drag-over.filled { filter: brightness(0.92); }

.schedule-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; }
/* ===== ALL SCHEDULES MATRIX ===== */
.all-matrix { min-width: 600px; }
.all-matrix th { padding: 6px 4px; font-size: 11px; }
.all-matrix .sched-cell { height: 40px; padding: 3px 5px; }
.all-matrix .lesson-subj { font-size: 11px; margin-bottom: 1px; }
.all-matrix .lesson-teacher { font-size: 10px; }
.day-separator td { background: #f1f5f9 !important; padding: 6px 12px; }
.day-separator td strong { color: var(--primary); font-size: 13px; }
.conflict-badge { position: absolute; top: 2px; right: 4px; font-size: 12px; }
/* ===== ALERTS ===== */
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #92400e; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #166534; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--surface); border-radius: 12px; padding: 24px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); animation: modalIn 0.2s ease-out; }
@keyframes modalIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal h3 { font-family: "Plus Jakarta Sans", sans-serif; font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-group input, .form-group select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text); }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.cell-info { background: #f8fafc; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.cell-info-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

.assign-options { display: flex; flex-direction: column; gap: 8px; }
.assign-option { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface); font-family: inherit; transition: all 0.15s; }
.assign-option:hover { background: #f8fafc; border-color: var(--primary); }
.ao-subj { font-weight: 700; font-size: 14px; }
.ao-teacher { font-size: 12px; color: var(--text-muted); }
.ao-conflict { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ===== CURRICULUM ===== */
.curriculum-preview { background: #f8fafc; border-radius: 8px; padding: 14px; margin: 12px 0; }
.curriculum-preview h4 { font-size: 13px; margin-bottom: 8px; color: var(--text-muted); }
.subj-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.subj-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid; border-radius: 20px; font-size: 12px; }
.subj-chip span { width: 8px; height: 8px; border-radius: 50%; }

.curriculum-table td { text-align: center; }
.curriculum-table .total-row td { background: #f8fafc; font-size: 14px; }

.curriculum-info h3 { font-size: 18px; font-weight: 700; margin: 24px 0 12px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.info-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--primary); }
.info-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.curriculum-source { margin-top: 24px; }
.source-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* ===== SETTINGS ===== */
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; }
.setting-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== UTILS ===== */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #1e293b; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md); z-index: 300; opacity: 0; transition: all 0.3s; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }
.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* ===== UNPLACED LESSONS ===== */
.unplaced-section { margin-top: 20px; padding: 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; }
.unplaced-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: #92400e; }
.unplaced-hint { font-size: 13px; color: #92400e; margin-bottom: 12px; }
.unplaced-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.unplaced-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; cursor: grab; min-width: 140px; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; user-select: none; }
.unplaced-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.unplaced-card:active { cursor: grabbing; transform: scale(0.96); }
.unplaced-card .subj-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.unplaced-card .teacher-name { font-size: 12px; color: var(--text-muted); }

/* ===== TEACHER HIGHLIGHT ===== */
.teacher-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.teacher-pill { padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; transition: all 0.15s; color: var(--text); }
.teacher-pill:hover { border-color: var(--primary); background: #f0fdfa; }
.teacher-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sched-cell.teacher-dim { opacity: 0.2; }
.sched-cell.teacher-highlight { box-shadow: 0 0 0 3px var(--primary) inset; }
.teacher-highlight-col { background: #f0fdfa !important; }
.teacher-dim-col { opacity: 0.4; }
.teacher-summary { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; }
.teacher-summary h4 { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--primary); }
.teacher-summary-row { display: flex; flex-wrap: wrap; gap: 10px; }
.teacher-summary-day { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.missing-part { display: inline-block; background: #fff; border: 1px solid #fde68a; color: #92400e; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; }
.split-list { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.split-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 5px 8px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.split-name { flex: 1; font-weight: 600; }
.split-hours { font-weight: 700; color: var(--primary); white-space: nowrap; }
.split-parts { color: var(--text-muted); font-size: 11px; text-align: right; flex: 1; }
.asgn-form-grid { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 10px; }
@media (max-width: 768px) {
  .asgn-form-grid { grid-template-columns: 1fr; }
  .split-parts { display: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding-bottom: 64px; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface); border-top: 1px solid var(--border);
    height: 56px; z-index: 99; justify-content: space-around; align-items: center;
  }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; font-size: 18px; cursor: pointer; font-family: inherit; color: var(--text-muted); padding: 6px 10px; }
  .bn-item.active { color: var(--primary); }
  .bn-label { font-size: 10px; font-weight: 600; }
  .assignment-list { grid-template-columns: 1fr; }
  .schedule-controls { flex-direction: column; align-items: stretch; }
  .control-actions { justify-content: stretch; }
  .control-actions .btn { flex: 1; justify-content: center; }
  .modal { margin: 8px; padding: 18px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ===== SIDEBAR INFO ===== */
.sidebar-info {
  font-size: 11px;
  color: #64748b;
  padding: 8px 0;
  text-align: center;
  line-height: 1.4;
}
