/* ENVIA LMS | Layout CSS: Containers, Header, Nav, App Shell, Sidebar */

.container {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.main {
  min-width: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-wrap {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.74rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.nav a:hover { color: var(--primary); }

/* App Layout */
.app-layout {
  min-height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: 250px 1fr;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.app-brand { margin-bottom: 18px; }

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.side-nav a:hover,
.side-nav a.active {
  background: #edf3ff;
  border-color: #dbe6ff;
  color: var(--primary);
}

.app-main { 
  display: grid; 
  grid-template-rows: auto 1fr; 
}

.app-topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-topbar h1 {
  margin: 0;
  font-size: 1.2rem;
}

.app-content {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.main > .topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  overflow: visible;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h3 {
  margin: 4px 0 0;
  line-height: 1.15;
}

.topbar-actions {
  margin-left: auto;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.main > :not(.topbar) {
  padding-left: 20px;
  padding-right: 20px;
}

/* Grid Utilities */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1080px) {
  .hero-grid, .grid-3, .grid-4, .grid-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4, .grid-6, .side-nav {
    grid-template-columns: 1fr;
  }
}

/* Unified authenticated application shell */
.app-shell {
  grid-template-columns: 280px minmax(0, 1fr);
  background:
    radial-gradient(circle at 12% 4%, rgba(202, 140, 32, 0.10), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef4fb 100%);
}

.sidebar {
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 18px;
  border-radius: 18px;
}

.app-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 14px;
  background: #f8fafc;
}

.app-brand strong { display: block; font-size: 0.95rem; letter-spacing: 0.02em; }
.app-brand small { display: block; margin-top: 3px; color: var(--text-soft); font-size: 0.76rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link .material-symbols-rounded {
  font-size: 20px;
  line-height: 1;
}

.side-divider {
  height: 1px;
  margin: 16px 0;
  background: var(--border);
}

.side-nav-secondary .nav-link {
  font-size: 0.84rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 250, 252, 0.80);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  backdrop-filter: blur(18px);
}

.topbar-kicker {
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
