/* ── DEMO BODY ── */
.demo-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
}

/* ── TOP NAV ── */
.demo-nav {
  height: 52px;
  min-height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  z-index: 50;
  flex-shrink: 0;
}

.demo-nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.demo-nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}
.demo-nav-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.2px;
}

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

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
}
.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-email {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── MAIN LAYOUT ── */
.demo-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── SIDEBAR ── */
.demo-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 16px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-of-type { border-bottom: none; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  margin-bottom: 2px;
  font-family: 'DM Sans', sans-serif;
}
.sidebar-item:hover { background: var(--bg2); }
.sidebar-item.active {
  background: var(--teal-light);
}
.sidebar-item.active .sidebar-item-name { color: var(--teal); }
.sidebar-item.active .sidebar-icon { background: var(--teal); color: #fff; }

.sidebar-icon {
  width: 30px;
  height: 30px;
  background: var(--bg2);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-icon svg { width: 15px; height: 15px; }

.sidebar-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.sidebar-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item-sub {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}

.sidebar-badge {
  font-size: 9px;
  font-weight: 700;
  background: #EEF2FF;
  color: #4338CA;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

/* Downloads section */
.sidebar-downloads { flex: 1; }

.download-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 6px;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.download-item:hover { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }
.download-item svg { flex-shrink: 0; }
.download-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.no-files-msg {
  font-size: 12px;
  color: var(--text3);
  padding: 4px 10px;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-help-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text3);
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-help-link:hover { color: var(--teal); }

/* ── CONTENT AREA ── */
.demo-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg2);
}

/* Loading state */
.demo-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text3);
  font-size: 14px;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PANELS ── */
.demo-panel {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.panel-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 4px;
}
.panel-sub {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}
.panel-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* iframe wrapper */
.iframe-wrap {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  min-height: 0;
}
.iframe-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

/* Power BI placeholder (shown when URL not configured) */
.iframe-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
  background: var(--bg2);
}
.placeholder-icon {
  width: 60px;
  height: 60px;
  background: var(--teal-light);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
}
.placeholder-icon svg { width: 28px; height: 28px; }
.iframe-placeholder h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.iframe-placeholder p { font-size: 13px; color: var(--text2); max-width: 380px; line-height: 1.6; }
.iframe-placeholder code {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: monospace;
  color: var(--teal);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .demo-sidebar { width: 200px; min-width: 200px; }
  .user-email { display: none; }
}
@media (max-width: 560px) {
  .demo-sidebar { display: none; }
  .demo-panel { padding: 12px; }
  .panel-header { flex-direction: column; }
}
