/* ─────────────────────────────────────────────────────────
   Cultural Agenda — Nav Rail + Command Bar + Shared Layout
   Shared across all pages (except login).
   Depends on CSS variables from styles.css.
   ───────────────────────────────────────────────────────── */

/* ══════════════════════════════════════════
   LEFT NAV RAIL
══════════════════════════════════════════ */
.nav-rail {
  width: 60px;
  background: #131110;
  border-right: 1px solid rgba(255,210,140,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 2px;
  flex-shrink: 0;
}

.rail-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #A06B2A);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  cursor: pointer;
}

.rail-item {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #8A8278;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.rail-item:hover { background: rgba(255,255,255,0.06); color: #C8C0B4; }
.rail-item:focus-visible { outline: 2px solid #C8924A; outline-offset: -2px; }
.rail-item.active {
  background: rgba(200,146,74,0.15);
  color: var(--gold-lt);
}
.rail-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.rail-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E09940;
  border: 2px solid #131110;
}

/* ── Rail tooltips (custom, instant) ── */
.rail-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  background: #f8f8f8;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s;
  z-index: 90;
}
.rail-item[data-tip]:hover::after {
  opacity: 1;
}

/* ── Vertical Switcher (Agenda / News) ── */
.rail-vertical-switcher {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px;
}
.rail-vertical {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6B6560;
  background: rgba(255,255,255,0.04);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  text-decoration: none;
  position: relative;
  border: 1.5px solid transparent;
}
.rail-vertical:hover {
  background: rgba(255,255,255,0.08);
  color: #A09A92;
}
.rail-vertical.active {
  background: rgba(200,146,74,0.14);
  color: #E0AD72;
  border-color: rgba(200,146,74,0.4);
}
.rail-vertical[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  background: #f8f8f8;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s;
  z-index: 90;
}
.rail-vertical[data-tip]:hover::after { opacity: 1; }

/* ── Divider between switcher and nav items ── */
.rail-divider {
  width: 26px;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 10px auto;
}

.rail-spacer { flex: 1; }


/* ══════════════════════════════════════════
   MOBILE — bottom bar <640px
══════════════════════════════════════════ */
@media (max-width: 640px) {
  body.admin-body { flex-direction: column; }
  .nav-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 56px;
    flex-direction: row;
    padding: 0 8px;
    gap: 4px;
    border-right: none;
    border-top: 1px solid rgba(255,210,140,0.08);
    z-index: 150;
    overflow-x: auto;
  }
  .nav-rail .rail-logo,
  .nav-rail .rail-divider { display: none; }
  .nav-rail .rail-spacer { display: none; }
  .nav-rail .rail-vertical-switcher {
    flex-direction: row;
    padding: 0;
    gap: 4px;
  }
  .nav-rail .rail-item,
  .nav-rail .rail-vertical {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .nav-rail .rail-item.active::before {
    left: 50%;
    top: auto;
    bottom: -2px;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 2px 2px 0 0;
  }
  /* Hide tooltips on mobile (no hover) */
  .nav-rail .rail-item[data-tip]::after,
  .nav-rail .rail-vertical[data-tip]::after { display: none; }
  /* User avatar sits inline at end */
  .nav-rail .rail-user-wrap { margin-top: 0; margin-left: auto; margin-bottom: 0; }
  .nav-rail .rail-user-menu {
    left: auto;
    right: 0;
    bottom: calc(100% + 8px);
  }
  /* Push main content up so it doesn't hide behind bar */
  .main-col { padding-bottom: 56px; }
}


/* ══════════════════════════════════════════
   MAIN COLUMN
══════════════════════════════════════════ */
.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* ══════════════════════════════════════════
   TOP COMMAND BAR
══════════════════════════════════════════ */
.cmd-bar {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
  overflow: hidden;            /* no horizontal scrollbar; right cluster is pinned */
}

/* Right-pinned cluster (badge + Refresh). margin-left:auto on the cmd-spacer
   already pushes us right, but we also fix flex-shrink so these never collapse. */
.cmd-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
/* Allow the middle (week-mode toggles) to shrink when space is tight rather
   than push the right cluster off the edge. */
.cmd-bar .week-nav { min-width: 0; flex-shrink: 1; overflow: hidden; }

.cmd-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.2px;
  color: var(--text);
  margin-right: 20px;
  white-space: nowrap;
}
.cmd-title span {
  color: var(--text3);
  font-weight: 400;
  font-size: 13px;
}

.cmd-sep {
  width: 1px;
  height: 20px;
  background: var(--border2);
  margin: 0 16px;
  flex-shrink: 0;
}

.cmd-spacer { flex: 1; }


/* ══════════════════════════════════════════
   WEEK NAVIGATION
══════════════════════════════════════════ */
.week-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-arrow {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.week-arrow:hover { border-color: var(--border3); color: var(--text2); background: var(--bg4); }
.week-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

.week-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  min-width: 144px;
  text-align: center;
}

/* Date-range picker (replaces week nav on the News page) */
.range-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.range-preset,
.range-date {
  height: 28px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  border-radius: 6px;
  padding: 0 8px;
  font: 500 12px/1 'JetBrains Mono', ui-monospace, monospace;
}
.range-preset {
  padding-right: 24px;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239e9aaa' stroke-width='2.5' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 9px 9px;
}
.range-preset option {
  background: var(--bg2, #1e1a28);
  color: var(--text, #e8e4f0);
}
.range-preset:hover,
.range-date:hover { border-color: var(--border3); }
.range-preset:focus-visible,
.range-date:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.range-date::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}
.range-dash { color: var(--text3); font-size: 12px; }
/* Dimmed when "Scheduled only" overrides the top date range — signals the
   inputs are inert in that mode without disabling them outright. */
.range-nav.is-muted { opacity: 0.35; pointer-events: none; }

/* Prominent Scheduled toggle next to the date range. Default = outline,
   .active = filled gold so the engaged state mirrors the refresh-btn accent. */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  margin-left: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 6px;
  font: 600 12px/1 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.toggle-btn:hover { border-color: var(--border3); background: var(--bg3); }
.toggle-btn.active {
  background: var(--gold);
  color: #1A0E02;
  border-color: var(--gold);
}
.toggle-btn.active:hover { background: var(--gold-lt); border-color: var(--gold-lt); }
.toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.week-mode {
  display: flex;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  margin-left: 8px;
}

.wm-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
}
.wm-btn.active { background: var(--bg4); color: var(--text); }
.wm-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }


/* ══════════════════════════════════════════
   PROGRESS PILL
══════════════════════════════════════════ */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 32px;
  margin-right: 10px;
}

.prog-bar-bg {
  width: 72px;
  height: 3px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
}

.prog-bar-fill {
  height: 100%;
  width: 62%;
  background: linear-gradient(90deg, var(--gold), var(--amber));
  border-radius: 2px;
}

.prog-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}
.prog-label b { color: var(--gold-lt); }

/* Progress summary (news) */
.prog-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-right: 8px;
  flex-shrink: 0;
}
.prog-country {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}
.prog-country b {
  color: var(--gold-lt);
  font-size: 11px;
  min-width: 18px;
}
.pchip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  cursor: default;
  white-space: nowrap;
}
.pchip.pending { background: rgba(255,180,60,.15); color: #e8a830; }
.pchip.published { background: rgba(100,180,255,.15); color: #6ab4ff; }
.pchip.approved { background: rgba(80,200,120,.15); color: #50c878; }
.pchip.rejected { background: rgba(255,100,100,.12); color: #ff6b6b; }


/* ══════════════════════════════════════════
   REFRESH BUTTON
══════════════════════════════════════════ */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 34px;
  background: var(--gold);
  color: #1A0E02;
  border: none;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.refresh-btn:hover { background: var(--gold-lt); transform: translateY(-1px); }
.refresh-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* District-progress chip — sits in the cmd-bar right cluster when a single
   district is filtered. Shows approved/min for the active district. */
.district-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  background: rgba(200,146,74,0.10);
  border: 1px solid rgba(200,146,74,0.30);
  border-radius: 999px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  color: var(--gold-lt, #d8a96d);
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 8px;
}
.district-progress .dp-name {
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.2px;
}
.district-progress .dp-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.5px;
}
.district-progress .dp-count b { font-weight: 700; }
.district-progress.is-reached {
  background: rgba(91,203,145,0.14);
  border-color: rgba(91,203,145,0.40);
  color: #5BCB91;
}

/* "Newly added" glance badge — sits left of Refresh in the cmd-bar. */
.added-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 30px;
  background: rgba(91,203,145,0.12);
  color: #5BCB91;
  border: 1px solid rgba(91,203,145,0.25);
  border-radius: 999px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
  margin-right: 8px;
}
.added-badge:hover { background: rgba(91,203,145,0.20); border-color: rgba(91,203,145,0.4); }
.added-badge:active { transform: scale(0.97); }
.added-badge.on {
  background: #5BCB91;
  color: #0B1A12;
  border-color: #5BCB91;
  box-shadow: 0 0 0 2px rgba(91,203,145,0.18);
}


/* ══════════════════════════════════════════
   USER AVATAR + EXPANDABLE MENU
══════════════════════════════════════════ */
.rail-user-wrap {
  position: relative;
  margin-top: auto;
  margin-bottom: 4px;
}
.rail-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg4);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.rail-avatar:hover { background: var(--bg5, var(--bg4)); }

.rail-user-menu {
  position: absolute;
  left: 52px;
  bottom: 0;
  width: 200px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  padding: 6px;
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: menuIn 0.15s ease;
}
.rail-user-menu.open { display: flex; }
@keyframes menuIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.rum-header {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.rum-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.rum-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.rum-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.rum-item:hover { background: var(--bg4); color: var(--text); }
.rum-item svg { opacity: 0.6; flex-shrink: 0; }

.rum-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 4px;
}

.rum-theme-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
}
.rum-theme-row svg { opacity: 0.6; flex-shrink: 0; }
.rum-theme-toggle {
  margin-left: auto;
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.rum-theme-btn {
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  background: none;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.15s;
}
.rum-theme-btn.active {
  background: var(--gold);
  color: #fff;
}


/* ══════════════════════════════════════════
   UTILITY: SVG baseline fix
══════════════════════════════════════════ */
.nav-rail svg,
.cmd-bar svg { display: block; flex-shrink: 0; }


/* ══════════════════════════════════════════
   LIGHT THEME — Nav rail stays dark
══════════════════════════════════════════ */
[data-theme="light"] .nav-rail {
  background: #131110;
  border-right: none;
}
[data-theme="light"] .nav-rail .rail-item {
  color: #8A8278;
}
[data-theme="light"] .nav-rail .rail-item:hover {
  background: rgba(255,255,255,0.06);
  color: #C8C0B4;
}
[data-theme="light"] .nav-rail .rail-item.active {
  background: rgba(200,146,74,0.18);
  color: #E0AD72;
}
[data-theme="light"] .nav-rail .rail-dot {
  border-color: #131110;
}
[data-theme="light"] .refresh-btn {
  color: #fff;
}
[data-theme="light"] .wm-btn.active {
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ── User menu (light theme) ── */
[data-theme="light"] .rail-user-menu {
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .rail-user-menu .rum-item {
  color: #5C564D;
}
[data-theme="light"] .rail-user-menu .rum-item:hover {
  background: #F5F4F1;
  color: #1A1815;
}
[data-theme="light"] .rail-user-menu .rum-header .rum-name { color: #1A1815; }
[data-theme="light"] .rail-user-menu .rum-header .rum-role { color: #938C82; }
[data-theme="light"] .rail-user-menu .rum-theme-row { color: #5C564D; }
[data-theme="light"] .rail-user-menu .rum-theme-toggle {
  background: #F5F4F1;
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .rail-user-menu .rum-theme-btn { color: #938C82; }
[data-theme="light"] .rail-user-menu .rum-divider { background: rgba(0,0,0,0.06); }

/* Avatar on dark rail in light mode */
[data-theme="light"] .rail-avatar {
  background: rgba(255,255,255,0.1);
  color: #EDEAD3;
}
[data-theme="light"] .rail-avatar:hover {
  background: rgba(255,255,255,0.15);
}

/* Light theme wm-btn shadow */
[data-theme="light"] .wm-btn.active {
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
