/* ═══════════════════════════════════════════
   Dashboard / App Layout CSS
════════════════════════════════════════════ */

/* ─── App Layout ─── */
#app-page {
  height: 100vh; overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width); min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto;
  transition: transform var(--transition-slow);
  position: relative; z-index: 200;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px; border-bottom: 1px solid var(--border-color);
}
.sidebar-logo img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand { flex: 1; min-width: 0; }
.sb-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; font-weight: 700; color: var(--text-primary);
}
.sb-sub { font-size: 10px; color: var(--text-muted); }
.sidebar-close {
  display: none; width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-muted);
  transition: all var(--transition);
}
.sidebar-close:hover { background: var(--bg-card); color: var(--text-primary); }

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}
.sidebar-avatar {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1a56db, #0e9f6e);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition); cursor: pointer;
  margin-bottom: 2px; position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
  background: var(--blue-bg); color: var(--brand-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--brand-primary); border-radius: 0 2px 2px 0;
}
.notif-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 100px; min-width: 20px; text-align: center;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border-color);
}
.btn-logout {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: all var(--transition);
}
.btn-logout:hover {
  background: var(--red-bg); color: var(--red);
}

/* ─── App Content ─── */
.app-content {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
  background: var(--bg-base);
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.menu-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition);
  border: 1px solid var(--border-color);
}
.menu-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.breadcrumb {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-theme {
  border: 1px solid var(--border-color); background: var(--bg-card);
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition);
}
.topbar-theme:hover { color: var(--brand-primary); }
.topbar-notif {
  position: relative; width: 38px; height: 38px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-card); display: flex; align-items: center;
  justify-content: center; color: var(--text-secondary);
  transition: all var(--transition);
}
.topbar-notif:hover { color: var(--brand-primary); border-color: var(--brand-primary); }
.topbar-notif-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 5px;
  border-radius: 100px; min-width: 18px; text-align: center;
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-card);
  cursor: pointer; transition: all var(--transition);
}
.topbar-user:hover { border-color: var(--brand-primary); }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 6px;
  background: linear-gradient(135deg, #1a56db, #0e9f6e);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { font-size: 11px; color: var(--text-muted); }

/* ─── Main Content ─── */
.main-content {
  flex: 1; overflow-y: auto; padding: 28px 24px;
}
.view { display: none; }
.view.active { display: block; }

/* ─── Sidebar Overlay (mobile) ─── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dashboard-grid-full { grid-column: 1 / -1; }

/* ─── Floor Comparison Table ─── */
.floor-comp-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.floor-comp-item:last-child { border-bottom: none; }
.fci-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); width: 80px; flex-shrink: 0; }
.fci-bar { flex: 1; }
.fci-pct { font-size: 13px; font-weight: 700; color: var(--text-primary); width: 45px; text-align: right; }

/* ─── Settings Card ─── */
.settings-section { margin-bottom: 28px; }
.settings-section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 14px;
}
.settings-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); overflow: hidden;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border-color);
  gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.settings-row-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ─── Toggle Switch ─── */
.toggle-switch {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--border-color); cursor: pointer;
  position: relative; transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--brand-primary); }
.toggle-switch::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* ─── Profile Avatar Upload ─── */
.avatar-upload {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 24px;
}
.avatar-preview {
  width: 72px; height: 72px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1a56db, #0e9f6e);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: block; }
  .app-content { width: 100%; }
  .main-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-user-name, .topbar-user-role { display: none; }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .main-content { padding: 16px 12px; }
  .view-header { gap: 10px; }
  .view-actions { width: 100%; }
  .view-actions .btn { flex: 1; justify-content: center; }
}
