/* ─────────────────────────────────────────────────────────────────────────
   base.css — Layout, Sidebar, Topbar, Design tokens
   ───────────────────────────────────────────────────────────────────────── */

/* Design tokens */
:root {
  --sidebar-bg: #1e2432;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --color-primary: #4a90e2;
  --color-primary-dark: #357ac9;
  --color-success: #27ae60;
  --color-danger: #e74c3c;
  --color-warning: #ffc107;
  --color-info: #17a2b8;
  --color-bg: #f5f6fa;
  --color-text: #2d2d2d;
  --color-muted: #888;
  --color-border: #e0e4ed;
  --color-card: #ffffff;
  --sidebar-item-hover: rgba(255,255,255,.08);
  --sidebar-item-active: rgba(74,144,226,.25);
  --sidebar-text: rgba(255,255,255,.75);
  --sidebar-text-active: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 2px 12px rgba(0,0,0,.12);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  font-size: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  padding: 0 20px 0 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,.07);
}

.topbar-brand {
  width: var(--sidebar-width);
  padding: 0 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand .brand-icon {
  font-size: 20px;
}

.topbar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.2px;
}

.topbar-brand .brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  margin-top: 1px;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Notification bell */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.7);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: background .15s, color .15s;
}
.notif-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}
.notif-badge.visible { display: flex; }

/* Notification dropdown */
.notif-dropdown {
  position: absolute;
  top: calc(var(--topbar-height) + 4px);
  right: 16px;
  width: 360px;
  max-height: 420px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 200;
}
.notif-dropdown.open { display: flex; }

.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
}

.notif-header button {
  font-size: 11px;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
}

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background .12s;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notif-item:hover { background: #f8f9fc; }
.notif-item.unread { background: #f0f6ff; }
.notif-item.unread:hover { background: #e8f0fc; }

.notif-item-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item-desc { font-size: 12px; color: var(--color-muted); line-height: 1.4; }
.notif-item-time { font-size: 11px; color: #bbb; margin-top: 3px; }

.notif-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--color-muted);
  font-size: 13px;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  padding: 16px 0;
}

.sidebar-section {
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 0 12px;
  margin-bottom: 4px;
  margin-top: 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar-item:hover { background: var(--sidebar-item-hover); color: #fff; }
.sidebar-item.active { background: var(--sidebar-item-active); color: var(--sidebar-text-active); }
.sidebar-item .icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 8px 12px;
}

/* ── Main content ──────────────────────────────────────────────────────── */
.main-content {
  margin-top: var(--topbar-height);
  margin-left: var(--sidebar-width);
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
}

/* ── Page header ───────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.page-header .page-sub {
  font-size: 13px;
  color: var(--color-muted);
}

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

/* ── Hamburger button ───────────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 14px;
  line-height: var(--topbar-height);
}

/* ── Mobile (≤768px) ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  .topbar-brand {
    width: auto;
  }
  /* 사이드바 열릴 때 배경 오버레이 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
  }
  .sidebar-overlay.open {
    display: block;
  }
  #toast-container {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  #toast-container .toast {
    min-width: unset;
    width: 100%;
  }
}
