/*
 * Shared styles for public/demo-frames/*.html
 * Mirrors the real app (components/features/sidebar.tsx + app/globals.css).
 * Keep each HTML file lean by reusing the tokens and primitives defined here.
 */

:root {
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --primary-muted: #eff6ff;
  --primary-600: #1d4ed8;
  --background: #eef1f7;
  --foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-card: 0 1px 2px rgb(15 23 42 / 0.04), 0 4px 12px rgb(15 23 42 / 0.06);
  --shadow-sidebar: 4px 0 24px rgb(15 23 42 / 0.06);
  --shadow-window: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Browser window chrome ──────────────────────────────────────────── */

.demo-app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.demo-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1180px, 100%);
  max-height: min(720px, calc(100vh - 32px));
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-window);
}

.demo-browser-bar {
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.demo-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}
.demo-dot.red {
  background: #ff5f57;
}
.demo-dot.yellow {
  background: #febc2e;
}
.demo-dot.green {
  background: #28c840;
}

.demo-url {
  margin-left: 10px;
  flex: 1;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 12px;
}

/* ─── Main layout (sidebar + content) ────────────────────────────────── */

.demo-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: 640px;
  max-height: 640px;
  min-height: 0;
  overflow: hidden;
}

.demo-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fcfdff;
}

.demo-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }
  .ds-sidebar {
    display: none !important;
  }
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */

.ds-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sidebar);
}

.ds-collapse-fake {
  position: absolute;
  right: 0;
  top: 2.5rem;
  z-index: 30;
  width: 32px;
  height: 32px;
  transform: translateX(50%);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ds-logo-wrap {
  flex-shrink: 0;
  padding: 1.25rem 0.75rem 0;
}

.ds-brand-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.375rem;
  margin-bottom: 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.ds-brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 0.5rem;
  background: var(--primary-muted);
  display: grid;
  place-items: center;
}
.ds-brand-icon img {
  width: 26px;
  height: 26px;
}

.ds-brand-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.ds-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0.75rem;
}

.ds-nav-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ds-nav-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.625rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: default;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}

.ds-nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.ds-nav-link:hover {
  background: rgba(239, 246, 255, 0.65);
  color: var(--foreground);
}
.ds-nav-link.ds-active {
  background: var(--primary-muted);
  color: var(--primary);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.ds-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-agenda-mini {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 0.5rem;
  background: rgba(241, 245, 249, 0.4);
}
.ds-agenda-mini h4 {
  margin: 0 0 0.375rem;
  padding: 0 0.125rem;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}
.ds-agenda-mini p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.ds-agenda-mini a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ds-sidebar-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.ds-upsell {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  margin-bottom: 0.25rem;
  border-radius: 0.5rem;
  background: rgba(239, 246, 255, 0.55);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.ds-upsell svg {
  color: var(--primary);
}

.ds-profile {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
}

.ds-avatar {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.ds-profile-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Page header (replicates .app-page-header from globals.css) ─────── */

.page-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 0 rgb(15 23 42 / 0.04);
}
.page-header .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-foreground);
}
.page-header h1 {
  margin: 0.125rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}
.page-header .subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ─── Cards ──────────────────────────────────────────────────────────── */

.app-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  box-shadow: var(--shadow-card);
}

/* ─── Embed override (no browser chrome, no window border) ───────────── */

.is-embed .demo-browser-bar {
  display: none !important;
}
.is-embed .demo-window {
  border-radius: 0;
  border: none;
  box-shadow: none;
  max-height: none;
}
.is-embed .demo-app {
  min-height: 100vh;
  padding: 0;
}
