/* ============================================
   APP — Base Styles & Layout
   ============================================ */

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

html { font-size: 16px; scroll-behavior: smooth; }

body.app-body {
  font-family: var(--ff-body);
  background: var(--clr-bg);
  color: var(--clr-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; cursor: pointer; background: none; color: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; border: none; outline: none; background: none; }
img { display: block; max-width: 100%; }
h1,h2,h3,h4,h5,h6 { font-family: var(--ff-heading); font-weight: var(--fw-bold); color: var(--clr-text); }

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

.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out);
  overflow: hidden;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--dur-normal) var(--ease-out);
}

.app-header {
  height: var(--header-height);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
}

.page {
  flex: 1;
  padding: var(--sp-6);
  max-width: 1200px;
  width: 100%;
}

/* ── Selection & Scrollbar ── */
::selection { background: var(--clr-accent); color: var(--clr-primary); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: var(--radius-full); }

/* ── Responsive ── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
}

/* ── Loading Spinner ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--clr-border);
  border-top-color: var(--clr-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  color: var(--clr-text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: var(--sp-4); }
.empty-state__title {
  font-family: var(--ff-heading); font-size: var(--fs-lg);
  font-weight: var(--fw-semibold); color: var(--clr-text);
  margin-bottom: var(--sp-2);
}
.empty-state__text { font-size: var(--fs-sm); margin-bottom: var(--sp-6); }
