/* ============================================================
   FRIDAY PLANNER — Layout
   ============================================================ */

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ───────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-brand {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand h1 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  letter-spacing: -0.02em;
}

.sidebar-brand .subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  padding: var(--space-3) var(--space-2);
  flex: 1;
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-2) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text-primary);
}

.nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.nav-item .nav-icon {
  font-size: 1.1em;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  background: var(--color-urgent);
  color: white;
  border-radius: var(--radius-full);
  padding: 0 6px;
  min-width: 20px;
  text-align: center;
  line-height: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* Capacity widget in sidebar */
.capacity-widget {
  background: var(--color-surface-2);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.capacity-widget .cap-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: space-between;
}

.capacity-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.capacity-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.capacity-bar-fill.warning { background: var(--color-medium); }
.capacity-bar-fill.danger  { background: var(--color-urgent); }

.capacity-stats {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* ── Main Content ────────────────────────────────────────────────────────────── */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  flex-shrink: 0;
  z-index: 5;
}

.header-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  flex: 1;
}

.header-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* Search bar */
.search-bar {
  position: relative;
}

.search-bar input {
  width: 240px;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  background: var(--color-surface-2);
  color: var(--color-text-primary);
  transition: border-color var(--transition);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.9em;
  pointer-events: none;
}

#content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

/* ── Views ───────────────────────────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -100%;
    height: 100%;
    transition: left 0.3s ease;
  }

  #sidebar.open { left: 0; }

  #main { width: 100%; }

  #content { padding: var(--space-4); }

  .search-bar input { width: 160px; }
}
