/* ── Sidebar layout ────────────────────────────────────────────────────── */
:root {
  --sidebar-w:        220px;
  --sidebar-w-coll:   64px;
  --sidebar-bg:       #20253a;
  --sidebar-active:   #05545a;
  --sidebar-hover:    rgba(255,255,255,.07);
  --topbar-h:         56px;
  --transition:       0.22s ease;
}

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

body.sidebar-layout {
  margin: 0;
  background: #f0f0f0;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  z-index: 200;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-coll); }

.sidebar-logo {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-logo img {
  width: 140px;
  transition: width var(--transition);
}
.sidebar.collapsed .sidebar-logo img { width: 36px; }

/* Nav links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  font-size: 14px;
}
.sidebar-link i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-link span { transition: opacity var(--transition); }
.sidebar.collapsed .sidebar-link span { opacity: 0; pointer-events: none; }

.sidebar-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; border-left: 3px solid #e600a0; }

/* Section labels */
.sidebar-section {
  padding: 16px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-section { opacity: 0; }

/* Collapse toggle button */
.sidebar-toggle {
  margin: 10px auto 14px;
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.2); }

/* ── Main wrapper ─────────────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
.main-wrap.collapsed { margin-left: var(--sidebar-w-coll); }

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-menu-btn {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: #20253a; display: none;
  padding: 4px 8px;
}

.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.profile-wrap {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: #20253a;
  position: relative;
}

.profile-card {
  display: none;
  position: absolute;
  top: 36px; right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 18px;
  min-width: 260px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  z-index: 999;
  font-size: 14px;
  line-height: 1.8;
}
.profile-card p { margin: 0 0 4px; }

.bt-logout-sm {
  background: #20253a; color: #fff;
  padding: 7px 18px; border-radius: 6px;
  font-size: 13px; text-decoration: none;
}
.bt-logout-sm:hover { background: #05545a; color: #fff; }

/* ── Page content ─────────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 30px;
}

/* Page header row */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-header h1 {
  font-size: 1.3rem;
  font-family: 'Archivo Black', Arial, sans-serif;
  color: #20253a;
  margin: 0;
}
.breadcrumb-bar {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}
.breadcrumb-bar a { color: #05545a; text-decoration: none; }
.breadcrumb-bar a:hover { text-decoration: underline; }

/* Content card */
.content-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin-bottom: 22px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
}
.stat-info .stat-val  { font-size: 1.5rem; font-weight: 700; color: #20253a; line-height: 1; }
.stat-info .stat-label { font-size: 12px; color: #888; margin-top: 3px; }

/* ── Submenu groups ──────────────────────────────────────────────────── */
.sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: rgba(255,255,255,.82);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
  user-select: none;
  font-size: 14px;
}
.sidebar-group-header i:first-child { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-group-header span { flex: 1; transition: opacity var(--transition); }
.sidebar-group-header:hover { background: var(--sidebar-hover); color: #fff; }

/* Chevron rotates when open */
.sidebar-chevron {
  font-size: 10px !important;
  transition: transform var(--transition);
  margin-left: auto;
  width: auto !important;
}
.sidebar-group.open .sidebar-chevron { transform: rotate(180deg); }

/* Sublinks body — hidden by default, slides open */
.sidebar-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: rgba(0,0,0,.15);
}
.sidebar-group.open .sidebar-group-body { max-height: 300px; }

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 46px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.sidebar-sublink i { font-size: 12px; width: 14px; text-align: center; }
.sidebar-sublink:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-sublink.active { color: #fff; font-weight: 600; border-left: 3px solid #e600a0; background: rgba(5,84,90,.4); }

/* Hide sublinks text when collapsed */
.sidebar.collapsed .sidebar-group-header span,
.sidebar.collapsed .sidebar-chevron,
.sidebar.collapsed .sidebar-sublink { opacity: 0; pointer-events: none; }
.sidebar.collapsed .sidebar-group-body { max-height: 0 !important; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-w-coll); }
  .sidebar .sidebar-link span,
  .sidebar .sidebar-section,
  .sidebar-logo img { opacity: 0; width: 36px; }
  .main-wrap { margin-left: var(--sidebar-w-coll); }
  .topbar-menu-btn { display: block; }
  .page-content { padding: 16px; }
}
