/* ============================================================
   DENTIUM PROTOTYPE — Base Styles & Layout Shell
   ============================================================ */

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

html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--font-primary);
  font-size: var(--text-body-size);
  color: var(--fg-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; background: none; border: none; font: inherit; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
h1 {
  font-family: var(--font-primary);
  font-size: var(--text-h1-size);
  font-weight: var(--text-h1-weight);
  color: var(--fg-primary);
}
h2 {
  font-family: var(--font-primary);
  font-size: var(--text-h2-size);
  font-weight: var(--text-h2-weight);
  color: var(--fg-primary);
}
h3 {
  font-family: var(--font-primary);
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  color: var(--fg-primary);
}
p {
  font-family: var(--font-primary);
  font-size: var(--text-body-size);
  color: var(--fg-primary);
}
label {
  font-family: var(--font-secondary);
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  color: var(--fg-primary);
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-cg-30);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-cg-60); }

/* ── APP SHELL ──────────────────────────────────────────── */
#app {
  min-height: 100vh;
}

#shell {
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1;
}

.sidebar-logo-den { color: var(--color-accent); }
.sidebar-logo-tium { color: var(--color-primary); }

.sidebar-logo-sub {
  font-size: 9px;
  font-family: var(--font-secondary);
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: var(--text-nav-size);
  font-weight: 400;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.nav-item:hover {
  background: var(--color-surface-subtle);
  color: var(--fg-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--color-primary);
  color: #FFFFFF;
  font-weight: 500;
}

.nav-item.active svg { color: #FFFFFF; }

.nav-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item-label { flex: 1; }

.sidebar-section-label {
  font-family: var(--font-secondary);
  font-size: 9px;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 10px 4px;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
}

.sidebar-role-badge {
  font-family: var(--font-secondary);
  font-size: 9px;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ── MAIN AREA ───────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP HEADER ─────────────────────────────────────────── */
#top-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  box-shadow: var(--shadow-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
  padding: 0 var(--space-8);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#page-title {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-dark);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  position: relative;
  border: none;
  background: transparent;
}

.header-icon-btn:hover {
  background: var(--color-surface-subtle);
  color: var(--fg-primary);
}

.header-icon-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.header-notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--color-accent);
  border-radius: 50%;
  border: 1.5px solid var(--bg-surface);
}

.header-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast) ease;
  border: none;
  background: transparent;
  position: relative;
}

.header-avatar-btn:hover { background: var(--color-surface-subtle); }

.header-role-chip {
  font-family: var(--font-secondary);
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.3px;
}

/* ── OUTLET (PAGE CONTENT) ──────────────────────────────── */
#outlet {
  margin-top: var(--header-height);
  padding: 28px 32px;
  min-height: calc(100vh - var(--header-height));
  flex: 1;
}

/* ── TOAST CONTAINER ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* ── PRINT RESET ────────────────────────────────────────── */
@media print {
  #shell,
  #sidebar,
  #top-header,
  .breadcrumb,
  .page-actions,
  .no-print { display: none !important; }

  #outlet { margin: 0; padding: 0; }
  .print-only { display: block !important; }
}

/* ── UTILITY HELPERS ─────────────────────────────────────── */
.text-primary   { color: var(--color-primary) !important; }
.text-muted     { color: var(--fg-muted) !important; }
.text-secondary { color: var(--fg-secondary) !important; }
.text-dark      { color: var(--fg-dark) !important; }
.text-success   { color: #10973E !important; }
.text-danger    { color: #CC1414 !important; }
.text-warning   { color: #DB7600 !important; }

.font-primary   { font-family: var(--font-primary) !important; }
.font-secondary { font-family: var(--font-secondary) !important; }
.font-mono      { font-family: 'SF Mono', 'Fira Code', monospace !important; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }

.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.flex-1        { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-4  { gap: var(--space-1); }
.gap-8  { gap: var(--space-2); }
.gap-12 { gap: var(--space-3); }
.gap-16 { gap: var(--space-4); }

.w-100 { width: 100%; }

.mt-4  { margin-top: var(--space-1); }
.mt-8  { margin-top: var(--space-2); }
.mt-12 { margin-top: var(--space-3); }
.mt-16 { margin-top: var(--space-4); }
.mb-8  { margin-bottom: var(--space-2); }
.mb-12 { margin-bottom: var(--space-3); }
.mb-16 { margin-bottom: var(--space-4); }
.mb-20 { margin-bottom: var(--space-5); }

.print-only { display: none; }
