:root {
  --gold:          #C5A811;
  --gold-light:    #e0c435;
  --black:         #000000;
  --surface:       #0a0a0a;
  --surface-2:     #111111;
  --surface-3:     #1a1a1a;
  --border:        rgba(197,168,17,0.3);
  --border-bright: rgba(197,168,17,0.7);
  --text:          #e8e8e8;
  --text-muted:    #888888;
  --radius:        8px;
  --radius-lg:     16px;
}

/* Base */
body,
#wiki-wrapper,
.wiki-base,
.container,
#article-container,
.wiki-article,
.wiki-content {
  background-color: var(--black) !important;
  color: var(--text) !important;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Audiowide', sans-serif;
  color: #ffffff;
  letter-spacing: 0.03em;
}

a {
  color: var(--gold) !important;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--gold-light) !important;
}

hr {
  border-color: var(--border) !important;
}

/* Scrollbar */
::-webkit-scrollbar { background: var(--surface-2); width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }

/* ---- NAVBAR ---- */
nav.navbar,
.navbar.navbar-dark,
.navbar-expand-lg {
  background-color: rgba(0,0,0,0.92) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-brand,
.nav-link,
.dropdown-toggle,
.navbar-nav > li > a {
  color: var(--text-muted) !important;
  font-family: 'Audiowide', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.navbar-brand:hover,
.nav-link:hover,
.dropdown-toggle:hover {
  color: var(--gold) !important;
}

.navbar-toggler {
  border: 1.5px solid var(--border-bright) !important;
  border-radius: var(--radius) !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28197%2C168%2C17%2C1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ---- DROPDOWNS ---- */
.dropdown-menu {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: var(--radius) !important;
  padding: 0.4rem !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}

.dropdown-item {
  color: var(--text-muted) !important;
  font-family: 'Audiowide', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.dropdown-item:hover {
  background-color: rgba(197,168,17,0.12) !important;
  color: var(--gold) !important;
}

/* ---- SEARCH ---- */
.input-group .form-control,
.directory-toolbar input[type="search"],
.form-control {
  background-color: var(--surface-2) !important;
  border: 1.5px solid var(--border-bright) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(197,168,17,0.15) !important;
  background-color: var(--surface-3) !important;
  outline: none;
}

.form-control::placeholder { color: var(--text-muted) !important; }

/* ---- BUTTONS ---- */
.btn {
  font-family: 'Audiowide', sans-serif !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius) !important;
  padding: 0.45rem 1.2rem !important;
  transition: all 0.2s !important;
  background-color: transparent !important;
  color: var(--gold) !important;
  border: 1.5px solid var(--gold) !important;
}

.btn:hover {
  background-color: var(--gold-light) !important;
  color: var(--black) !important;
  border-color: var(--gold-light) !important;
  box-shadow: 0 0 16px rgba(197,168,17,0.25) !important;
  transform: translateY(-1px);
}

.btn-outline-light {
  border-color: var(--border-bright) !important;
  color: var(--gold) !important;
}

/* ---- ARTICLE MENU / NAV PILLS ---- */
#article-menu,
.nav-pills {
  background-color: var(--surface-2) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem;
}

#article-menu .nav-link {
  color: var(--text-muted) !important;
  font-family: 'Audiowide', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  transition: background 0.2s, color 0.2s;
}

#article-menu .nav-link:hover {
  color: var(--gold) !important;
  background-color: rgba(197,168,17,0.08);
}

#article-menu .nav-link.active {
  color: var(--gold) !important;
  background-color: rgba(197,168,17,0.14) !important;
}

/* ---- BREADCRUMBS ---- */
.breadcrumb {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 0.6rem 1rem !important;
  margin-bottom: 1.5rem;
}

.breadcrumb-item a { color: var(--gold) !important; }
.breadcrumb-item.active { color: var(--text-muted) !important; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--border-bright) !important; }

/* ---- PAGE HEADER ---- */
.page-header,
h1.page-header {
  color: #ffffff !important;
  border-bottom: 1px solid var(--border) !important;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

/* ---- FORMS (create/edit articles) ---- */
.form-horizontal,
.form-group,
.row.form-group {
  background-color: transparent !important;
}

label,
.wiki-label label,
.control-label {
  font-family: 'Audiowide', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted) !important;
  margin-bottom: 0.35rem;
  display: block;
  font-weight: normal !important;
}

.wiki-control input[type="text"],
.wiki-control textarea,
.wiki-control select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  background-color: var(--surface-2) !important;
  border: 1.5px solid var(--border-bright) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  padding: 0.5rem 0.85rem !important;
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 1rem !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  outline: none !important;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(197,168,17,0.15) !important;
  background-color: var(--surface-3) !important;
}

.form-text.text-muted,
#hint_id_slug,
#hint_id_summary {
  color: var(--text-muted) !important;
  font-size: 0.85rem;
}

/* Form actions bar */
.form-actions,
.form-group.form-actions {
  background-color: var(--surface-2) !important;
  border-top: 1px solid var(--border) !important;
  padding: 1rem 0;
}

/* ---- MARKITUP EDITOR ---- */
.markItUp {
  background-color: var(--surface-2) !important;
  border: 1.5px solid var(--border-bright) !important;
  color: var(--text) !important;
  font-family: 'Space Mono', monospace;
}

.markItUpHeader {
  background-color: var(--surface-3) !important;
  border-bottom: 1px solid var(--border) !important;
}

.markItUpHeader a {
  color: var(--gold) !important;
}

/* ---- CARDS ---- */
.card {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text) !important;
}

.card-title { color: #ffffff !important; }
.wiki-card-toggle { color: var(--text) !important; }

/* ---- TABLES ---- */
.table th {
  background-color: var(--surface-3) !important;
  color: var(--gold) !important;
  font-family: 'Audiowide', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border) !important;
}

.table td {
  color: var(--text) !important;
  border-color: rgba(197,168,17,0.1) !important;
}

.table tbody tr:hover {
  background-color: rgba(197,168,17,0.05) !important;
}

/* ---- CODE BLOCKS ---- */
pre, code {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--gold-light) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 0.88rem;
}

pre { padding: 1rem; overflow-x: auto; }

/* ---- DIRECTORY TOOLBAR ---- */
.directory-toolbar,
.form-search,
.directory-toolbar .form-inline {
  background-color: var(--surface-2) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 0.75rem 0;
}

/* ---- BADGES / NOTIFICATIONS ---- */
.badge-light, .badge {
  background-color: rgba(197,168,17,0.2) !important;
  color: var(--gold) !important;
  font-family: 'Audiowide', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
}

/* ---- ALERTS ---- */
.alert {
  border-radius: var(--radius) !important;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
}

.alert-success {
  background-color: rgba(68,204,119,0.12) !important;
  border-color: rgba(68,204,119,0.4) !important;
  color: #44cc77 !important;
}

.alert-danger {
  background-color: rgba(255,68,68,0.12) !important;
  border-color: rgba(255,68,68,0.4) !important;
  color: #ff6666 !important;
}

.alert-info {
  background-color: rgba(100,160,255,0.1) !important;
  border-color: rgba(100,160,255,0.3) !important;
  color: #88bbff !important;
}

/* ---- WIKI FOOTER ---- */
#wiki-footer {
  color: var(--text-muted) !important;
  border-top: 1px solid var(--border) !important;
  margin-top: 3rem;
  padding-top: 1rem;
}

/* ---- SELECT2 (tag selectors) ---- */
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
  background-color: var(--surface-2) !important;
  border: 1.5px solid var(--border-bright) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
}

.select2-container--default .select2-results__option--highlighted {
  background-color: rgba(197,168,17,0.18) !important;
  color: var(--gold) !important;
}

.select2-dropdown {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: var(--radius) !important;
}

.select2-results__option { color: var(--text) !important; }

/* ---- CONTAINER SPACING ---- */
.container[style*="margin-top"] {
  margin-top: 1.5rem !important;
}

/* ============================================================
   NAVBAR Z-INDEX FIX
   The wiki Bootstrap bundle doesn't always stack the navbar
   above page content. Force it here.
   ============================================================ */

nav.navbar,
.navbar.navbar-dark,
.navbar-expand-lg {
  position: sticky !important;
  top: 0 !important;
  z-index: 1030 !important;
}

.navbar .dropdown-menu {
  z-index: 1040 !important;
  position: absolute !important;
}

/* Ensure nothing from the page content leaks above the nav */
.container > *,
#article-container,
.wiki-article,
.breadcrumb,
#article-menu {
  position: relative;
  z-index: 1;
}
