/*
 * studio.css — ViewDAO Studio shared stylesheet
 * All Studio pages link to this. Page-specific CSS stays inline.
 * Load order: studio.css → page inline <style> (overrides as needed)
 */

/* ── Reset ─────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700;800&display=swap');

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

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  --white: #fff;
  --off: #f7f8fb;
  --gray-50: #f3f5f9;
  --gray-100: #e7eaf2;
  --gray-200: #d7dce8;
  --gray-300: #b8c0d0;
  --gray-400: #8a94a8;
  --gray-600: #4b5568;
  --gray-800: #1f2633;
  --ink: #111827;

  --accent: #8B5CF6;
  --accent-mid: #06B6D4;
  --accent-lt: #f0ebff;

  --green: #22c55e;
  --green-lt: #dcfce7;
  --green-soft: #dcfce7;

  --amber: #f59e0b;
  --amber-lt: #fef9c3;
  --amber-soft: #fef9c3;

  --red: #ef4444;
  --red-lt: #fef2f2;

  --teal: #06B6D4;
  --teal-lt: #ccfbf1;

  --orange: #f97316;
  --orange-lt: #ffedd5;

  --blue: #3b82f6;
  --blue-lt: #dbeafe;

  /* semantic aliases */
  --bg: var(--off);
  --surface: var(--white);
  --surface-2: var(--gray-50);
  --border: var(--gray-100);
  --border-hover: var(--gray-200);
  --text-1: var(--ink);
  --text-2: var(--gray-600);
  --text-3: var(--gray-400);
  --accent-soft: var(--accent-lt);
  --accent-2: var(--accent);
  --accent-2-soft: var(--accent-lt);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow-md: 0 14px 36px rgba(15,23,42,.08);
  --shadow-accent: 0 18px 42px rgba(139,92,246,.2);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;

  --sidebar-w: 248px;
  --sidebar-collapsed-w: 70px;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0b1020;
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  box-shadow: 18px 0 44px rgba(15,23,42,.1);
}
.sidebar-header { padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.sidebar-logo-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(6,182,212,.22);
  flex-shrink: 0;
}
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; }
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  color: rgba(255,255,255,.68);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(6,182,212,.16)); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.07);
  cursor: pointer;
  transition: background .15s;
}
.user-chip:hover { background: rgba(255,255,255,.11); }
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Main layout ────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: calc(100vw - var(--sidebar-w));
  max-width: none;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
}

body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-w);
  width: calc(100vw - var(--sidebar-collapsed-w));
}

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  backdrop-filter: blur(18px);
}
.topbar-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.studio-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.studio-top-help,
.studio-top-primary,
.studio-top-secondary {
  height: 28px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.studio-top-help {
  width: 28px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(91,124,255,.35);
}
.studio-top-primary {
  padding: 0 14px;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, var(--accent-mid), var(--teal));
  box-shadow: 0 10px 22px rgba(91,124,255,.2);
}
.studio-top-secondary {
  padding: 0 14px;
  color: #3451d1;
  border: 1px solid rgba(91,124,255,.28);
  background: linear-gradient(135deg, rgba(139,92,246,.1), rgba(0,209,255,.14));
}
.studio-top-help:hover,
.studio-top-secondary:hover {
  border-color: rgba(91,124,255,.48);
  background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(0,209,255,.2));
  color: #1d4ed8;
}
.studio-top-primary:hover { filter: brightness(.98); transform: translateY(-1px); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary, .btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff;
  box-shadow: 0 10px 22px rgba(139,92,246,.22);
}
.btn-primary:hover, .btn-accent:hover { filter: brightness(.98); transform: translateY(-1px); }
.btn-primary:disabled, .btn-accent:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost {
  background: var(--white);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-50); color: var(--ink); transform: translateY(-1px); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

/* ── Page body ──────────────────────────────────────────────────── */
.page-body { flex: 1; padding: 28px; overflow-y: auto; }
.content    { flex: 1; padding: 24px; min-width: 0; max-width: 100%; overflow-x: hidden; }

body.sidebar-collapsed .page-body,
body.sidebar-collapsed .content,
body.sidebar-collapsed .body {
  max-width: none !important;
  width: 100%;
  box-sizing: border-box;
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: all .3s;
  z-index: 500;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show  { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #16a34a; }
.toast.error   { background: var(--red); }

/* ── Studio footer ──────────────────────────────────────────────── */
#studio-footer {
  border-top: 1px solid var(--gray-100);
  background: var(--white);
  padding: 0 28px;
  height: 36px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.studio-footer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--gray-400);
  font-family: var(--font-body);
}
.sf-sep { opacity: .45; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1); }
  .sidebar.open { transform: translateX(0); z-index: 51; }
  .main { margin-left: 0 !important; }
}

/* Studio ViewDAO theme: cool blue, dense, research-desk surfaces */
:root {
  --white: #ffffff;
  --off: #f4f8ff;
  --gray-50: #eef5ff;
  --gray-100: #dbeafe;
  --gray-200: #bfdbfe;
  --gray-300: #93a8c8;
  --gray-400: #64748b;
  --gray-600: #334155;
  --gray-800: #0f172a;
  --ink: #0b1220;

  --accent: #5b7cff;
  --accent-mid: #8b5cf6;
  --accent-lt: #e8efff;

  --green: #16a34a;
  --green-lt: #dcfce7;
  --green-soft: #dcfce7;

  --amber: #d97706;
  --amber-lt: #fef3c7;
  --amber-soft: #fef3c7;

  --red: #dc2626;
  --red-lt: #fee2e2;

  --teal: #00d1ff;
  --teal-lt: #dff8ff;
  --blue: #2563eb;
  --blue-lt: #dbeafe;
  --orange: #b96d34;
  --orange-lt: #f2e3d7;

  --bg: var(--off);
  --surface: var(--white);
  --surface-2: var(--gray-50);
  --border: var(--gray-100);
  --border-hover: var(--gray-200);
  --text-1: var(--ink);
  --text-2: var(--gray-600);
  --text-3: var(--gray-400);
  --accent-soft: var(--accent-lt);
  --accent-2: var(--accent);
  --accent-2-soft: var(--accent-lt);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(37, 99, 235, .06);
  --shadow-md: 0 14px 30px rgba(15, 23, 42, .12);
  --shadow-accent: 0 18px 42px rgba(91, 124, 255, .22);

  --font-display: 'Space Grotesk', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Space Grotesk', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font-family: var(--font-body);
}

.btn-primary,
.btn-accent {
  background: linear-gradient(135deg, var(--accent-mid), var(--teal));
  color: #fff;
  box-shadow: 0 10px 22px rgba(91, 124, 255, .2);
}

.btn-primary:hover,
.btn-accent:hover {
  filter: brightness(.98);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}
