/* ============================================================
   ATLAS ONE — Layout
   Sidebar, header, main content area positioning.
   ============================================================ */

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--grey-800);
  background: var(--grey-100);
  -webkit-font-smoothing: antialiased;
}

/* Inter everywhere — platform-wide rule. Form controls and SVG don't inherit
   the body font by default, so set them explicitly. */
button, input, select, textarea, svg text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--blue);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Fixed height = header height so the logo's bottom border lines up
   exactly with the header's bottom border (and never shifts on nav). */
.sidebar-logo {
  height: var(--header-height);
  min-height: var(--header-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-img {
  height: 26px;
  max-width: 150px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  display: block;
}

.sidebar-logo-text {
  color: var(--white);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.22em;
  /* nudge for the trailing tracking so the wordmark looks centred */
  padding-left: 2px;
  line-height: 1;
}

/* Default brand mark in the sidebar: the official Atlas wordmark in white
   (uses the shared .atlas-mark mask, recoloured via `color`). */
.sidebar-logo-mark {
  color: var(--white);
  width: 132px;
  aspect-ratio: 1530.5 / 187.2;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 14px 16px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.sidebar-section-label:first-child { padding-top: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.10);
  color: var(--white);
}

.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border-left-color: var(--white);
  font-weight: 600;
}

.nav-item.coming-soon {
  opacity: 0.45;
  cursor: default;
}

.nav-item.coming-soon:hover {
  background: none;
  color: rgba(255,255,255,0.75);
}

.nav-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-item-icon {
  opacity: 1;
}

.nav-item-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
}

.nav-sub-items {
  display: none;
  flex-direction: column;
}

.nav-sub-items.open {
  display: flex;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 42px;
  cursor: pointer;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
}

.nav-sub-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.nav-sub-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-left-color: rgba(255,255,255,0.6);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.sidebar-footer-link {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
}
.sidebar-footer-link:hover {
  color: var(--white);
  text-decoration: underline;
}

/* ---- Main Area ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Header ---- */
.header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  padding: 0 var(--content-padding);
  gap: 16px;
  z-index: 50;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-subtitle {
  font-size: 12px;
  color: var(--grey-500);
  margin-left: 8px;
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Header icon buttons (gear, bell) */
.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--grey-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.header-icon-btn:hover {
  background: var(--grey-100);
  color: var(--navy);
}

/* Notification badge on bell */
.header-notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 15px;
  height: 15px;
  background: var(--red);
  color: #F0F0F0;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  pointer-events: none;
}

/* Profile avatar circle */
.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--blue-mid);
  color: #F0F0F0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 4px;
  transition: opacity var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
}
.header-avatar:hover { opacity: 0.85; border-color: var(--white); }

/* ---- Page Content ---- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--content-padding);
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 3px; }

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title-block {}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-description {
  display: none;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--grey-200);
  margin: 24px 0;
}

/* ============================================================
   MOBILE NAV — hamburger button + drawer backdrop
   Hidden on desktop; revealed by the responsive rules below.
   ============================================================ */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: -6px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--grey-700);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--grey-100); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}
.sidebar-backdrop.open { display: block; }

/* ============================================================
   RESPONSIVE — desktop-first; these apply only on smaller screens
   ============================================================ */

/* Tablet & mobile: sidebar collapses into a slide-out drawer */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-toggle { display: flex; }

  .header { padding: 0 16px; }
  .page-content { padding: 16px; }
  .page-header { margin-bottom: 16px; }
  .page-title { font-size: 19px; }
}

/* Phones: tighter spacing, stacked page header */
@media (max-width: 600px) {
  .page-content { padding: 12px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { flex-wrap: wrap; }
  .page-actions .btn { flex: 1; justify-content: center; }
}
