/* ============================================================
   LandAxis Hub v2 — Layout: Sidebar + Topbar + Main
   ============================================================ */

/* ── App Shell ── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface-0);
  border-right: 1px solid var(--border-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(0,0,0,0.3);
}

/* ── Logo ── */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 16px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
  width: 88%;
  height: auto;
  max-height: 160px;
  display: block;
  object-fit: contain;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 20px 10px 5px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.nav-section-label:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  position: relative;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(224,112,32,0.16) 0%, rgba(224,112,32,0.04) 100%);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

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

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

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 6px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: var(--surface-1);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1.5px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
  letter-spacing: 0.02em;
  margin-top: 1px;
}

/* ============================================================
   Main Column (topbar + content)
   ============================================================ */

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: 54px;
  flex-shrink: 0;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-md);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.topbar-breadcrumb .crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-breadcrumb .crumb-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.topbar-btn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}

.topbar-btn svg {
  width: 15px;
  height: 15px;
}

.topbar-notification {
  position: relative;
}

.topbar-notification::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--surface-0);
}

/* ── Content Area ── */
#content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  padding: 30px 32px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.page.active {
  display: block;
}

.page-map.active {
  display: flex;
  padding: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

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

.page-title {
  font-family: var(--font-tight);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
  font-weight: 400;
}

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

/* ── Grid helpers ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 190px; }
}

/* ── Dashboard two-col layout ── */
.dashboard-lower {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .dashboard-lower { grid-template-columns: 1fr; }
}
