/* ============================================================
   assets/css/layout.css
   Sidebar, topbar, main wrapper, grid helpers.
   ============================================================ */

/* ─── App shell ─── */
html, body { height:100%; }
body { display:flex; flex-direction:column; }

.app-shell { display:flex; height:100vh; overflow:hidden; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.el-wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.el-sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white-dim);
  opacity: 0.7;
}
.sidebar-search {
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  overscroll-behavior: contain;
}
.nav-section-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint, rgba(245, 242, 238, 0.3));
  padding: 12px 20px 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  color: var(--white-dim);
  cursor: pointer;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.nav-item:hover { background: var(--white-faint); color: var(--white); }
.nav-item.active {
  color: var(--white);
  background: var(--gold-dim);
  border-right: 2px solid var(--gold);
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.red { background: var(--error); color: #fff; }
.sidebar-user {
  padding: 14px 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.sidebar-user:hover { background: var(--white-faint); }
.user-info .user-name { font-size: 13px; font-weight: 500; }
.user-info .user-role { font-size: 10px; color: var(--white-dim); }
.sidebar-logout-btn:hover {
  background: var(--white-faint);
  color: var(--white);
}

/* ─── Topbar ─── */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: rgba(13,13,13,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-greeting { flex: 1; min-width: 0; }
.greeting-text { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.greeting-date { font-size: 11px; color: var(--white-dim); }
.topbar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: none;
  color: var(--white-dim);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.topbar-btn svg { width: 18px; height: 18px; }
.topbar-btn:hover { background: var(--white-faint); color: var(--white); }
.topbar-divider { width: 0.5px; height: 18px; background: var(--border2); margin: 0 4px; }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--error);
  border: 1.5px solid var(--black);
}

/* ─── Notification panel ─── */
.notif-panel {
  position: fixed;
  top: 56px; right: 12px;
  width: 320px;
  background: var(--surface);
  border: 0.5px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 200;
  max-height: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
}
.notif-panel.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.notif-header {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.notif-header-title { font-size: 13px; font-weight: 500; }
.notif-mark-read { font-size: 11px; color: var(--gold); cursor: pointer; opacity: 0.8; }
.notif-mark-read:hover { opacity: 1; }
#notifList { overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--white-faint); }
.notif-item.unread { background: var(--gold-dim); }
.notif-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.notif-text { font-size: 12px; line-height: 1.5; }
.notif-ts { font-size: 10px; color: var(--text-dim, rgba(245, 242, 238, 0.35));; margin-top: 2px; }

/* ─── Main content ─── */
.main { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page-wrap { padding: 32px; max-width: 1400px; }

/* ─── Section header ─── */
.section-hdr {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-hdr h2 { font-size: clamp(20px,2.5vw,28px); }
.rule { flex: 1; height: 0.5px; background: var(--border); }

/* ─── Grid helpers ─── */
.grid-2-1 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.grid-2   { display: grid; grid-template-columns: 1fr 1fr;   gap: 14px; }
.grid-3   { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }

/* ─── Page tabs ─── */
.page-tabs {
  display: flex;
  gap: 0;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ptab {
  padding: 9px 16px;
  font-size: 12px;
  color: var(--white-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ptab:hover { color: var(--white); }
.ptab.active { color: var(--white); border-bottom-color: var(--gold); }

/* ─── User avatar ─── */
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--gold),#8B6914);
  color: #000;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond',serif;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

/* ─── Metric cards ─── */
.metric-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--white-dim); margin-bottom: 6px; }
.metric-val { font-family: 'Cormorant Garamond',serif; font-size: 32px; font-weight: 400; line-height: 1; }
.metric-change { font-size: 11px; margin-top: 4px; color: var(--white-dim); }
.metric-change.up { color: var(--success); }
.metric-change.dn { color: var(--error); }
.m-gold { border-top: 2px solid var(--gold); }
.m-green { border-top: 2px solid var(--success); }
.m-blue  { border-top: 2px solid var(--info); }
.m-red   { border-top: 2px solid var(--error); }

/* ─── Info banner ─── */
.info-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--gold-dim);
  border: 0.5px solid var(--gold-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--white-dim);
  line-height: 1.6;
}
.info-banner strong { color: var(--white); }
.card-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--white-dim); margin-bottom: 10px; }

/* ─── Role badge ─── */
.role-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: 20px; }
.role-badge.admin { background: var(--gold-dim); color: var(--gold); border: 0.5px solid var(--gold-border); }
.role-badge.manager { background: rgba(46,134,193,0.15); color: #5DADE2; }
.role-badge.staff { background: var(--surface3); color: var(--white-dim); }
