:root {
  --sidebar-w: 260px;
  --bg-base: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border: #334155;
  --text-muted: #64748b;
  --accent: #3b82f6;
}

body {
  background: var(--bg-base);
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Sidebar ── */
#wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .25s, min-width .25s;
  z-index: 100;
}

.sidebar-collapsed .sidebar { width: 68px; min-width: 68px; }
.sidebar-collapsed .sidebar .hide-collapsed { display: none !important; }

.sidebar-brand {
  padding: 1.1rem 1.1rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: .6rem;
  white-space: nowrap;
}
.sidebar-brand i { font-size: 1.4rem; color: var(--accent); flex-shrink: 0; }

.sidebar-divider { border-color: var(--border); margin: 0; }

.sidebar-nav { padding: .5rem .65rem; flex: 1; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: .5rem;
  margin-bottom: .2rem;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-size: .875rem;
}
.sidebar-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-hover); color: #f8fafc; }
.sidebar-link.active { background: #1d4ed8; color: #fff; }

.sidebar-bottom { padding: .65rem; border-top: 1px solid var(--border); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .4rem;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .875rem;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: .8rem; color: #f1f5f9; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;
}
.sidebar-logout {
  margin-left: auto; color: #64748b; font-size: 1.1rem;
  text-decoration: none; padding: .25rem; border-radius: .25rem; flex-shrink: 0;
}
.sidebar-logout:hover { color: #ef4444; }

/* ── Page wrapper ── */
#page-content-wrapper { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Stat cards ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1.25rem;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: .5rem;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}

/* ── Course cards ── */
.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.course-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }

.course-card-accent { height: 4px; }

.course-card-body { padding: 1.25rem; }

.course-code {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: .2rem .55rem; border-radius: .3rem;
}

/* ── Planning notes ── */
.note-item {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: .9rem 1rem;
}

.week-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
}

/* ── Iframe viewer ── */
.content-iframe {
  width: 100%; border: none;
  height: calc(100vh - 160px);
  border-radius: .5rem;
  background: #0f172a;
}

/* ── Progress ── */
.progress { height: 5px; background: var(--border); }

/* ── Login ── */
.login-page {
  min-height: 100vh; background: var(--bg-base);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 1rem; padding: 2.5rem;
  width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo i { font-size: 2.75rem; color: var(--accent); }

/* ── Tabs ── */
.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { color: #94a3b8; border: none; padding: .65rem 1rem; }
.nav-tabs .nav-link:hover { color: #f8fafc; border: none; background: transparent; }
.nav-tabs .nav-link.active { color: #fff; background: transparent; border-bottom: 2px solid var(--accent); }

/* ── Table ── */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--border); }

/* ── Misc ── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

@media (max-width: 768px) {
  .sidebar { position: fixed; transform: translateX(-100%); height: 100%; }
  #wrapper.sidebar-open .sidebar { transform: translateX(0); }
  #page-content-wrapper { width: 100%; }
}
