/* =============================================================
   base.css — Reset, typography, layout utilities
   ============================================================= */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  color: var(--green-light);
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  line-height: 1.25;
  color: var(--text);
}

/* ── Typography ─────────────────────────────────────────────── */
.h1 { font-size: clamp(2rem, 5vw, 3rem);  font-weight: 700; }
.h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.h3 { font-size: 1.25rem; font-weight: 600; }
.h4 { font-size: 1.1rem;  font-weight: 600; }

.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-green { color: var(--green); }
.text-center { text-align: center; }

/* ── Layout utilities ───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* ── Spacing ────────────────────────────────────────────────── */
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

/* ── Header / Nav ───────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--green-light);
}

/* ── Sidebar layout ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar__logo {
  padding: 0 var(--space-6) var(--space-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.sidebar__nav {
  flex: 1;
  padding: 0 var(--space-3);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: var(--space-1);
}

.sidebar__link:hover {
  background: var(--green-pale);
  color: var(--green);
}

.sidebar__link.active {
  background: var(--green-pale);
  color: var(--green);
  font-weight: 600;
}

.sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: var(--space-8) var(--space-8);
  min-height: 100vh;
}

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Admin top nav ──────────────────────────────────────────── */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
  max-width: 100%;
  padding-inline: var(--space-8);
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-family: var(--font-heading);
  margin-bottom: var(--space-2);
  color: var(--text);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding-inline: var(--space-4);
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .app-layout {
    flex-direction: column;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }

  .top-nav__inner {
    padding-inline: var(--space-4);
  }
}
