:root {
  --app-shell-max: 1360px;
  --app-content-max: 1200px;
}

/* CANONICAL VIEWPORT GUTTER & ORIGIN RESET */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

html, body {
  margin: 0;
  padding: 0;
}

/* TOPBAR HEADER & STABLE GEOMETRY */
.topbar.v-app-topbar {
  position: sticky;
  top: 0;
  margin: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  height: 52px !important;
  max-height: 52px !important;
  width: 100%;
  box-sizing: border-box;
}

.topbar.v-app-topbar .topbar-inner {
  max-width: var(--app-shell-max, 1360px) !important;
  width: 100%;
  margin: 0 auto !important;
  padding: 0 24px !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .topbar.v-app-topbar .topbar-inner {
    padding: 0 20px !important;
  }
}

@media (max-width: 480px) {
  .topbar.v-app-topbar .topbar-inner {
    padding: 0 16px !important;
  }
}

.topbar.v-app-topbar .topbar-logo {
  font-size: 1.125rem;
  font-weight: 800;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: -0.025em;
  flex-shrink: 0;
}

.topbar.v-app-topbar .topbar-logo:hover {
  color: #06b6d4;
}

/* DESKTOP NAV LINKS */
@media (min-width: 769px) {
  .topbar.v-app-topbar .topbar-nav-desktop {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin-left: 0 !important;
    flex-shrink: 0 !important;
    height: 100% !important;
  }
  .topbar.v-app-topbar .mobile-menu-btn {
    display: none !important;
  }
}

.topbar.v-app-topbar .topbar-link {
  display: inline-flex !important;
  align-items: center !important;
  height: 30px !important;
  line-height: 1 !important;
  font-size: 0.84375rem !important;
  font-weight: 600 !important;
  color: #94a3b8;
  text-decoration: none;
  padding: 0 10px !important;
  border-radius: 6px;
  border: 1px solid transparent;
  box-sizing: border-box !important;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.topbar.v-app-topbar .topbar-link:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.topbar.v-app-topbar .topbar-link.active {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.10);
  border-color: rgba(6, 182, 212, 0.20);
  font-weight: 600;
}

.topbar.v-app-topbar .spacer {
  flex: 1 1 auto;
  min-width: 20px;
}

/* OPERATIONAL ROLE SWITCH (ADMIN / TEACHER) */
.v-op-switch-container {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.v-op-switch-btn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  line-height: 1;
  background: rgba(245, 158, 11, 0.10);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 10px;
  border-radius: 6px;
  text-decoration: none;
  gap: 5px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.v-op-switch-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

/* MOBILE MENU BUTTON */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 4px 6px;
}

/* USER AUTH AREA - DETERMINISTIC RESERVED SLOT FROM FIRST PAINT (CAP-APP-V2-007B9B) */
#top-right-auth {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  min-width: 160px;
  min-height: 28px;
  box-sizing: border-box;
}

.v2-auth-skeleton-pill {
  width: 140px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  gap: 4px;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  line-height: 1;
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.login-btn, .join-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  line-height: 1;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0 16px;
  border-radius: 8px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.login-btn {
  color: #cbd5e1;
}

.login-btn:hover {
  color: #ffffff;
}

.join-btn {
  background: #06b6d4;
  color: #ffffff;
}

.join-btn:hover {
  background: #0891b2;
}

/* SIDEBAR MOBILE DRAWER */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #0f172a;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-brand {
  margin-bottom: 32px;
}

.sidebar-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}

.sidebar-subtitle {
  font-size: 0.8125rem;
  color: #64748b;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-nav a {
  font-size: 1rem;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav a.active {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.12);
  font-weight: 700;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* CANONICAL APP FOOTER */
.app-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 15, 26, 0.95);
  backdrop-filter: blur(12px);
  padding: 24px 20px;
  width: 100%;
  flex-shrink: 0;
}

.app-footer-inner,
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--v2-shell-max-width, 1240px);
  margin-left: auto;
  margin-right: auto;
  font-size: 0.8125rem;
  color: #64748b;
  gap: 20px;
  flex-wrap: wrap;
}

.app-footer-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-footer a:hover {
  color: #f8fafc;
}

/* RESPONSIVE BREAKPOINTS (MOBILE TOPBAR & FOOTER UX CONTRACT) */
@media (max-width: 768px) {
  .topbar-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
  }
  .topbar-logo {
    margin: 0 !important;
    text-align: left !important;
  }
  .mobile-menu-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
  }
  .spacer {
    display: none !important;
  }
  .topbar.v-app-topbar .topbar-nav-desktop {
    display: none !important;
  }
  .v-op-switch-container {
    display: none !important;
  }
  #top-right-auth {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .app-footer {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 12px !important;
    padding: 24px 16px !important;
  }

  .app-footer-left,
  .app-footer-center,
  .app-footer-right {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 !important;
  }

  .app-footer-center {
    gap: 24px !important;
  }
}

