@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@700&family=Nunito:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* =========================================
   VARIABLES
   ========================================= */
:root {
  --cb-bg: #2f1e46;
  --cb-text: #f6f4ff;
  --cb-muted: #e3dcf6;
  --cb-accent: #d6b6ff;
  --cb-accent-soft: rgba(183, 166, 255, 0.2);
  --cb-hero-gradient: linear-gradient(120deg, #f7b7e4 0%, #bda7ff 55%, #8fb7ff 100%);
  --cb-button-gradient: linear-gradient(120deg, #f7b7e4 0%, #bda7ff 100%);
  --cb-radius: 16px;
  --cb-shadow: 0 18px 45px rgba(20, 12, 32, 0.55);
  --cb-font-ui: 'Fredoka', 'Nunito', sans-serif;
  --cb-font-body: 'Nunito', sans-serif;
  --cb-font-mono: 'IBM Plex Mono', monospace;
  --cb-outline-shadow:
    -2px -2px 2px rgba(0, 0, 0, 0.8),
     2px -2px 2px rgba(0, 0, 0, 0.8),
    -2px  2px 2px rgba(0, 0, 0, 0.8),
     2px  2px 2px rgba(0, 0, 0, 0.8);
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(90deg, #ffb6c1 0%, #ffb6c1 15%, #c18ef0 45%, #5cb3ff 75%, #3399ff 100%);
  background-attachment: fixed;
  color: var(--cb-text);
  font-family: var(--cb-font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

input::selection,
textarea::selection {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

input, textarea {
  caret-color: rgba(255, 255, 255, 0.85);
}

/* =========================================
   TYPOGRAPHY & LINKS
   ========================================= */
body, .card, .card-body, p, li, td, th {
  font-family: var(--cb-font-body);
  color: var(--cb-text);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--cb-font-ui);
  color: var(--cb-text);
}

/* Gold links — skip buttons, nav-links, pagination, badges */
a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.navbar-brand) {
  color: #f6d77a;
  text-decoration: none;
  text-underline-offset: 4px;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.navbar-brand):hover {
  color: #ffe9a8;
  text-decoration: underline;
  text-shadow: var(--cb-outline-shadow);
}

/* =========================================
   BUTTONS — solid pastel, white text, pill shape
   ========================================= */
.btn {
  font-family: var(--cb-font-ui);
  font-weight: 600;
  border-radius: 999px !important;
  padding: 8px 24px;
  border-width: 2px;
  border-style: solid;
  color: #fff !important;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Small variant — tighter padding for compact UI areas */
.btn-sm {
  padding: 5px 14px !important;
  font-size: 0.85rem;
}

.btn-primary {
  background: #b388ff !important;
  border-color: #9c6fff !important;
}

.btn-secondary {
  background: #80cbc4 !important;
  border-color: #4db6ac !important;
}

.btn-success {
  background: #a5d6a7 !important;
  border-color: #81c784 !important;
}

.btn-danger {
  background: #ef9a9a !important;
  border-color: #e57373 !important;
}

.btn-warning {
  background: #ffe082 !important;
  border-color: #ffd54f !important;
}

.btn-info {
  background: #90caf9 !important;
  border-color: #64b5f6 !important;
}

/* Outline variants — translucent with matching border */
.btn-outline-light {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

.btn-outline-primary {
  background: rgba(179, 136, 255, 0.1) !important;
  border-color: #b388ff !important;
}

.btn-outline-primary:hover {
  background: rgba(179, 136, 255, 0.22) !important;
}

.btn-outline-secondary {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.btn-outline-success {
  background: rgba(165, 214, 167, 0.1) !important;
  border-color: #a5d6a7 !important;
}

.btn-outline-success:hover {
  background: rgba(165, 214, 167, 0.22) !important;
}

.btn-outline-danger {
  background: rgba(239, 154, 154, 0.1) !important;
  border-color: #ef9a9a !important;
}

.btn-outline-danger:hover {
  background: rgba(239, 154, 154, 0.22) !important;
}

.btn-outline-warning {
  background: rgba(255, 224, 130, 0.1) !important;
  border-color: #ffe082 !important;
}

.btn-outline-warning:hover {
  background: rgba(255, 224, 130, 0.22) !important;
}

/* =========================================
   CARDS — glass dark
   ========================================= */
.card {
  background: rgba(0, 0, 0, 0.22) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: var(--cb-radius) !important;
  box-shadow: 0 20px 48px rgba(20, 8, 32, 0.45) !important;
  color: var(--cb-text);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
}

.card-body {
  color: var(--cb-text);
}

.card-soft {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.08));
  border-radius: var(--cb-radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card-title {
  font-family: var(--cb-font-ui);
  font-weight: 700;
  color: var(--cb-text);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.card-subtitle {
  color: var(--cb-muted) !important;
}

/* =========================================
   ALERTS — rounded, themed
   ========================================= */
.alert {
  border-radius: 20px !important;
  font-weight: 600;
}

/* =========================================
   FORMS — dark inputs
   ========================================= */
.form-control,
.form-select {
  background: rgba(0, 0, 0, 0.3) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px !important;
  font-family: var(--cb-font-body);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cb-accent) !important;
  box-shadow: 0 0 0 3px var(--cb-accent-soft) !important;
  background: rgba(0, 0, 0, 0.4) !important;
  color: #fff !important;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-label {
  color: var(--cb-text);
  font-weight: 600;
}

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

/* Chrome autofill dark override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  box-shadow: 0 0 0 1000px rgba(20, 12, 32, 0.9) inset;
  transition: background-color 999999s ease-in-out 0s;
}

/* =========================================
   TABLES — override Bootstrap CSS vars for dark glass theme
   ========================================= */

/* Body rows: transparent background so the card glass shows through */
.table {
  --bs-table-color: var(--cb-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(255, 255, 255, 0.1);
  --bs-table-striped-color: var(--cb-text);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-active-color: var(--cb-text);
  --bs-table-active-bg: rgba(255, 255, 255, 0.08);
  --bs-table-hover-color: var(--cb-text);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
  color: var(--cb-text);
  border-color: rgba(255, 255, 255, 0.1);
}

/* thead.table-dark: semi-transparent dark header, no solid #212529 */
.table-dark {
  --bs-table-color: #fff;
  --bs-table-bg: rgba(0, 0, 0, 0.35);
  --bs-table-border-color: rgba(255, 255, 255, 0.15);
  --bs-table-striped-color: #fff;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
  --bs-table-active-color: #fff;
  --bs-table-active-bg: rgba(255, 255, 255, 0.1);
  --bs-table-hover-color: #fff;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.08);
}

/* =========================================
   BADGES
   ========================================= */
.badge {
  font-family: var(--cb-font-ui);
}

/* =========================================
   IDENTITY PILLS (profile option toggles)
   ========================================= */
.identity-pill {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--cb-text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  font-weight: 600;
  font-family: var(--cb-font-ui);
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.identity-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Checked state: the hidden checkbox is immediately before its label in the DOM */
.identity-check:checked + .identity-pill {
  background: var(--cb-accent);
  border-color: var(--cb-accent);
  color: #fff;
}

/* =========================================
   PAGINATION
   ========================================= */
.page-link {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--cb-text);
}

.page-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.page-item.active .page-link {
  background: var(--cb-button-gradient);
  border-color: transparent;
  color: #fff;
}

.page-item.disabled .page-link {
  background: rgba(0, 0, 0, 0.15);
  color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.08);
}

/* =========================================
   BANNER — full width, edge to edge
   ========================================= */
.site-banner-wrap {
  width: 100%;
  line-height: 0;
  overflow: visible;
}

.site-banner-wrap a {
  display: block;
  width: 100%;
}

.site-banner-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  max-width: 100%;
}

/* =========================================
   NAVBAR — transparent glass, below banner
   ========================================= */
.cb-nav {
  position: relative;
  z-index: 1030;
  background: rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.cb-nav .navbar-brand {
  font-family: var(--cb-font-ui);
  font-weight: 700;
  font-size: 1.4rem;
  color: #fff;
  text-shadow: var(--cb-outline-shadow);
}

.cb-nav .nav-link {
  font-family: var(--cb-font-body);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9) !important;
  border-radius: 999px;
  transition: color 0.15s, text-shadow 0.15s;
}

.cb-nav .nav-link:hover,
.cb-nav .nav-link.active {
  color: #fff !important;
  text-shadow: var(--cb-outline-shadow);
  background: transparent;
}

.cb-nav .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.3);
}

.cb-nav .navbar-toggler-icon {
  filter: invert(1);
}

.cb-nav .text-light {
  text-shadow: var(--cb-outline-shadow);
}

/* =========================================
   NAV TABS — site-themed pill style
   ========================================= */
.nav-tabs {
  border-bottom: 1px solid rgba(255,255,255,0.15) !important;
}

.nav-tabs .nav-link {
  color: rgba(255,255,255,0.6) !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  padding: 6px 18px !important;
  font-family: var(--cb-font-ui) !important;
  font-weight: 600 !important;
  background: transparent !important;
}

.nav-tabs .nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08) !important;
  border-color: transparent !important;
}

.nav-tabs .nav-link.active {
  color: #fff !important;
  background: rgba(179,136,255,0.25) !important;
  border-color: rgba(179,136,255,0.5) !important;
}

/* =========================================
   DROPDOWN MENUS
   ========================================= */
.dropdown-menu {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
  margin-top: 8px !important;
  z-index: 9999 !important;
  background: linear-gradient(90deg, #ffb6c1 0%, #ffb6c1 15%, #c18ef0 45%, #5cb3ff 75%, #3399ff 100%) !important;
  background-attachment: fixed !important;
}

.dropdown-item {
  color: rgba(255,255,255,0.9) !important;
  font-family: var(--cb-font-body);
  font-weight: 600;
  border-radius: 8px;
  margin: 2px 4px;
  padding: 6px 12px;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}

/* =========================================
   FOOTER — transparent, centered
   ========================================= */
.cb-footer {
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 20px 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
}

.cb-footer small {
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* =========================================
   SCROLLBAR
   ========================================= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* =========================================
   LUCIDE ICONS
   ========================================= */
.lucide {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  display: inline-block;
  flex-shrink: 0;
}

/* =========================================
   MOBILE & RESPONSIVE
   ========================================= */

/* iOS Safari ignores background-attachment: fixed entirely.
   Detect iOS with the touch-callout feature query and fall back to scroll
   so the gradient still renders correctly without a frozen/blank background. */
@supports (-webkit-touch-callout: none) {
  body {
    background-attachment: scroll;
  }
}

/* Collapsed navbar on mobile: the .navbar-collapse content sits inside
   .container and has no background of its own, so links float over the
   gradient. Add a dark glass panel so they're always readable. */
@media (max-width: 767.98px) {
  .cb-nav .navbar-collapse.show,
  .cb-nav .navbar-collapse.collapsing {
    background: linear-gradient(90deg, #ffb6c1 0%, #ffb6c1 15%, #c18ef0 45%, #5cb3ff 75%, #3399ff 100%) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 8px 12px;
    margin-top: 8px;
  }

  /* Larger tap targets for nav links on mobile */
  .cb-nav .nav-link {
    padding: 0.6rem 1rem;
    border-radius: 8px;
  }

  /* Subtle row highlight on hover/active inside the collapsed panel */
  .cb-nav .nav-link:hover,
  .cb-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.08) !important;
  }

  /* Visually separate the auth section (login/logout) from the page links */
  .cb-nav .navbar-nav + .navbar-nav {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 6px;
    padding-top: 6px;
  }

  /* Logout button: full-width pill in the mobile menu */
  .cb-nav .navbar-nav .btn {
    width: 100%;
    margin-top: 4px;
  }

  /* Username greeting: give it left-aligned padding so it lines up with links */
  .cb-nav .navbar-nav .nav-item.d-flex {
    padding: 0.4rem 1rem;
  }
}

/* =========================================
   PROSE (CMS rendered Markdown)
   ========================================= */
.prose { line-height: 1.75; }

.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 {
  font-family: var(--cb-font-ui);
  color: var(--cb-text);
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
}

.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.3rem; }

.prose p { margin-bottom: 1rem; }

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.6rem;
}

.prose li { margin-bottom: 0.3rem; }

.prose a {
  color: #f6d77a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover { color: #ffe9a8; }

.prose code {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: var(--cb-font-mono);
  font-size: 0.88em;
  color: var(--cb-accent);
}

.prose pre {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.prose pre code {
  background: none;
  padding: 0;
  color: var(--cb-text);
  font-size: 0.9em;
}

.prose blockquote {
  border-left: 4px solid var(--cb-accent);
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  color: var(--cb-muted);
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 2rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}

.prose th, .prose td {
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: left;
}

.prose th {
  background: rgba(0, 0, 0, 0.25);
  font-weight: 700;
}

.prose img {
  max-width: 100%;
  border-radius: 8px;
}

/* =========================================
   PAGE HEADER BAR
   ========================================= */
.page-header-bar {
  padding: 20px 0 0;
  text-align: center;
}

.page-header-title {
  font-family: var(--cb-font-ui);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin: 0 0 14px 0;
  display: inline-block;
}

.page-header-divider {
  display: block;
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  margin: 0 auto;
}

/* =========================================
   UTILITIES
   ========================================= */
.text-muted {
  color: var(--cb-muted) !important;
}

.small,
small {
  color: var(--cb-muted);
}

/* =========================================
   INLINE CUSTOM EMOJI
   ========================================= */
.inline-emoji {
  height: 1.8em;
  width: auto;
  vertical-align: -0.4em;
  display: inline;
}

/* =========================================
   EMOJI MART PICKER — theme overrides
   ========================================= */
em-emoji-picker {
  --rgb-background: 30, 15, 50;
  --rgb-input: 0, 0, 0;
  --rgb-color: 246, 244, 255;
  --rgb-accent: 179, 136, 255;
  --border-radius: 16px;
  --font-family: var(--cb-font-body);
  --emoji-size: 28px;
  --emoji-padding: 6px;
  height: 360px;
  width: 300px;
}

.emoji-picker-container {
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  overflow: hidden;
}
