/* ============================================
   Global Layout — Notion-Inspired
   ============================================ */

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ---- Pages ---- */

.page {
  display: none;
  flex: 1;
  overflow: hidden;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ---- Auth Layout ---- */

.auth-page {
  align-items: center;
  justify-content: center;
  background: var(--canvas-soft);
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: var(--space-xl);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-xxl);
  box-shadow: var(--shadow-elevated);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo h1 {
  font-size: var(--text-heading-1);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-heading-1);
  color: var(--primary);
}

.auth-logo p {
  color: var(--ink-muted);
  margin-top: var(--space-xs);
  font-size: var(--text-caption);
}

/* ---- Dashboard Layout ---- */

.dashboard-page {
  flex-direction: row;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--hairline);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--hairline);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--canvas-soft);
}

/* ---- Board Layout ---- */

.board-page {
  position: relative;
}

.board-toolbar {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-sticky);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-xs) var(--space-sm);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.board-canvas {
  flex: 1;
  overflow: hidden;
  position: relative;
  cursor: grab;
  background: var(--canvas-soft);
}

.board-canvas:active {
  cursor: grabbing;
}

.canvas-container {
  position: absolute;
  transform-origin: 0 0;
}

.minimap {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  width: 160px;
  height: 120px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  z-index: var(--z-sticky);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--text-button);
  font-weight: var(--weight-medium);
  line-height: var(--leading-dense);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primary CTA — pill shape, single blue action */
.btn-primary {
  background: var(--primary);
  color: var(--ink-inverse);
  border-radius: var(--radius-full);
  padding: 8px 20px;
}

.btn-primary:hover {
  background: var(--primary-active);
}

.btn-primary:active {
  background: var(--primary-active);
  transform: scale(0.97);
}

/* Secondary CTA — white pill with shadow */
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
  border-color: var(--ink-faint);
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* Utility button — tight radius, hairline border */
.btn-ghost {
  background: var(--surface);
  color: var(--ink-secondary);
  border-radius: var(--radius-md);
  padding: 4px 14px;
  border: 1px solid var(--hairline);
  font-size: var(--text-body-sm);
}

.btn-ghost:hover {
  background: var(--canvas-soft);
}

/* Danger button */
.btn-danger {
  background: var(--danger);
  color: var(--ink-inverse);
  border-radius: var(--radius-full);
  padding: 8px 20px;
}

/* Block */
.btn-block {
  width: 100%;
}

/* Icon circular */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.04);
  border: none;
  font-size: var(--text-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(0,0,0,0.08);
}

.btn-icon:active {
  transform: scale(0.9);
}

/* Google button */
.btn-google {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  gap: var(--space-sm);
  font-size: var(--text-body-sm);
}

.btn-google svg {
  width: 20px;
  height: 20px;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  color: var(--ink-muted);
  margin-bottom: var(--space-xxs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 6px var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

input::placeholder {
  color: var(--ink-faint);
}

/* ---- Cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.card-elevated {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
}

/* ---- Badge ---- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  text-transform: uppercase;
}

/* ---- Toolbar ---- */

.toolbar-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  color: var(--ink-secondary);
  position: relative;
}

.toolbar-btn:hover {
  background: var(--canvas-soft);
}

.toolbar-btn:active {
  background: var(--hairline);
}

.toolbar-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--hairline);
  margin: 0 4px;
}

.toolbar-label {
  font-size: var(--text-xs);
  color: var(--ink-faint);
  min-width: 36px;
  text-align: center;
  font-family: var(--font-mono);
}

/* ---- Board Items ---- */

.board-item {
  position: absolute;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--hairline);
  transition: box-shadow var(--transition-fast);
}

.board-item.selected {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-soft);
}

/* ---- Dividers ---- */

hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: var(--space-md) 0;
}

/* ---- Utility ---- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.hidden { display: none !important; }
