@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* ── Override Wagtail CSS custom properties ──────── */
:root {
  --w-color-primary: #2563eb;
  --w-color-primary-200: #bfdbfe;
  --w-color-primary-100: #dbeafe;
  --w-color-secondary: #f59e0b;
  --w-color-secondary-100: #fffbeb;
  --w-color-text-context: #1e293b;
  --w-color-surface-page: #f8fafc;
  --w-color-surface-field: #ffffff;
  --w-color-surface-header: #1e293b;
  --w-color-surface-menus: #0f172a;
  --w-color-border-field-default: #cbd5e1;
  --w-color-border-furniture: #e2e8f0;
}

/* ── Base ─────────────────────────────────────────── */
body {
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif !important;
}

/* ── Header bar ──────────────────────────────────── */
header[data-wagtail-header],
.w-slim-header,
.w-header {
  background: #1e293b !important;
  border-bottom: 1px solid #334155;
  box-shadow: none !important;
}

/* Force ALL text inside header to be white */
.w-header *,
.w-header h1,
.w-header h1 *,
.w-header h2,
.w-header h2 *,
.w-header .w-breadcrumbs *,
.w-header__title,
.w-header__title *,
.w-slim-header *,
header[data-wagtail-header] h1,
header[data-wagtail-header] h1 * {
  color: #f8fafc !important;
}

/* Header search */
.w-header input[type="search"],
.w-header .w-field__input input {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: 6px !important;
  color: #e2e8f0 !important;
}

/* ── Sidebar (main nav) ──────────────────────────── */
.sidebar {
  background: #0f172a !important;
  border-right: 1px solid #1e293b;
  width: 280px !important;
  min-width: 280px !important;
}

/* Shift content area to match wider sidebar */
.wrapper {
  padding-inline-start: 227px !important;
}
.sidebar-collapsed .wrapper {
  padding-inline-start: 60px !important;
}

/* Position submenu flyout – no gap between sidebar and submenu */
.sidebar-panel--open {
  inset-inline-start: 220px !important;
  z-index: 500 !important;
}
/* Keep nested (3rd level) panel tight to its parent */
.sidebar-panel .sidebar-panel--open {
  inset-inline-start: 200px !important;
  z-index: 600 !important;
}

.sidebar-menu-item__link {
  color: #8aa5cb !important;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.12s ease;
}

.sidebar-menu-item__link:hover {
  background: rgba(255,255,255,0.06) !important;
  color: #f1f5f9 !important;
}

.sidebar-menu-item--active > .sidebar-menu-item__link {
  background: linear-gradient(135deg, #0891b2, #0ea5e9) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(8, 145, 178, 0.35);
}

.sidebar-menu-item__label {
  color: #cbd5e1;
}

/* ── Sidebar sub-menu flyout panel ───────────────── */
[data-side-panel],
aside[data-side-panel],
.sidebar-sub-menu-panel,
.w-sidebar__content,
[data-side-panel="sub-menu"],
.sidebar [data-side-panel] {
  background: #0f1d32 !important;
  border-left: 1px solid #1e293b !important;
  color: #e2e8f0 !important;
}

/* All text inside submenu panels must be light */
[data-side-panel] *,
aside[data-side-panel] *,
.sidebar-sub-menu-panel *,
.w-sidebar__content * {
  color: #cbd5e1 !important;
}

[data-side-panel] h2,
aside[data-side-panel] h2,
[data-side-panel] .sidebar-sub-menu-panel h2,
.sidebar-sub-menu-panel h2,
.w-sidebar__content h2 {
  color: #ffffff !important;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  letter-spacing: 0.02em;
}

[data-side-panel] .sidebar-menu-item__link,
aside[data-side-panel] .sidebar-menu-item__link,
.sidebar-sub-menu-panel .sidebar-menu-item__link {
  color: #94b8db !important;
  font-size: 0.85rem;
  border-radius: 6px;
  transition: all 0.12s ease;
}

[data-side-panel] .sidebar-menu-item__link:hover,
aside[data-side-panel] .sidebar-menu-item__link:hover,
.sidebar-sub-menu-panel .sidebar-menu-item__link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.10) !important;
}

[data-side-panel] .sidebar-menu-item--active > .sidebar-menu-item__link,
aside[data-side-panel] .sidebar-menu-item--active > .sidebar-menu-item__link,
.sidebar-sub-menu-panel .sidebar-menu-item--active > .sidebar-menu-item__link {
  background: linear-gradient(135deg, #0891b2, #0ea5e9) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(8, 145, 178, 0.35);
}

/* Submenu SVG icons */
[data-side-panel] .sidebar-menu-item__link .icon,
[data-side-panel] svg,
.sidebar-sub-menu-panel svg {
  color: #64748b !important;
  fill: currentColor;
}

[data-side-panel] .sidebar-menu-item__link:hover .icon,
[data-side-panel] .sidebar-menu-item__link:hover svg,
.sidebar-sub-menu-panel .sidebar-menu-item__link:hover svg {
  color: #94b8db !important;
}

/* Sidebar branding */
.sidebar-custom-branding,
.sidebar-branding,
.w-branding {
  background: rgba(255,255,255,0.05) !important;
  color: #ffffff !important;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
}


/* ── Breadcrumbs ─────────────────────────────────── */
.w-breadcrumbs {
  font-size: 0.8rem;
}

/* ── Main content ────────────────────────────────── */
.content-wrapper,
.w-main,
main {
  background: #f0f4f8;
}

/* ── Panels – themed rows ────────────────────────── */
.w-panel {
  background: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: background 0.12s ease;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.w-panel:nth-child(odd) {
  background: #f0f7ff !important;
}

.w-panel:nth-child(even) {
  background: #ffffff !important;
}

.w-panel:hover {
  background: #e6f1fe !important;
}

/* Kill ALL extra spacing inside panels */
.w-panel > *,
.w-panel__header,
.w-panel__content,
.w-panel .w-field,
.w-panel .w-field__wrapper,
.w-panel .w-field__input {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Remove panel chrome (collapse toggles, anchors, dots) */
.w-panel__icon,
svg.icon.icon-dots-horizontal.w-panel__icon {
  display: none !important;
}

button.w-panel__toggle {
  pointer-events: none;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

button.w-panel__toggle svg {
  display: none !important;
}

a.w-panel__anchor.w-panel__anchor--prefix {
  display: none !important;
}

.w-panel__header {
  padding: 0 !important;
  margin-bottom: 0 !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
}

.w-panel__heading,
.w-panel__heading--label {
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0891b2 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.4 !important;
  white-space: nowrap;
}

.w-panel__content {
  padding: 0 !important;
}

/* ── Field wrappers ──────────────────────────────── */
.w-field {
  margin-bottom: 0 !important;
  padding: 0 !important;
}

.w-field__wrapper {
  gap: 2px !important;
  padding: 0 !important;
}

.w-field__label,
.w-field label {
  font-weight: 600;
  font-size: 0.8rem;
  color: #334155 !important;
  margin-bottom: 2px !important;
  padding: 0 !important;
  line-height: 1.3 !important;
}

/* Required field marker */
.w-required-mark {
  color: #ef4444 !important;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 2px;
}

.w-field__help,
.help {
  color: #6b7280 !important;
  font-size: 0.75rem !important;
  font-style: italic;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  line-height: 1.3;
}

/* ── Form inputs ─────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
textarea,
.w-field__input input,
.w-field__input textarea {
  background: #ffffff !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 6px !important;
  padding: 7px 12px !important;
  font-size: 0.85rem !important;
  color: #1e293b !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04) !important;
  height: auto !important;
  min-height: 0 !important;
  line-height: 1.4 !important;
  width: 100% !important;
  max-width: 100% !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Select / dropdown styling */
select,
.w-field__input select {
  background: #ffffff !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 6px !important;
  padding: 7px 36px 7px 12px !important;
  font-size: 0.85rem !important;
  color: #1e293b !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04) !important;
  height: auto !important;
  min-height: 0 !important;
  line-height: 1.5 !important;
  width: 100% !important;
  max-width: 100% !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 14px !important;
  cursor: pointer !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Textareas can be taller */
textarea,
.w-field__input textarea {
  min-height: 60px !important;
}

input:focus,
textarea:focus,
select:focus,
.w-field__input input:focus,
.w-field__input textarea:focus,
.w-field__input select:focus {
  background: #ffffff !important;
  border-color: #0891b2 !important;
  box-shadow: 0 0 0 3px rgba(8,145,178,0.12) !important;
  outline: none !important;
}

::placeholder {
  color: #9ca3af;
}

/* Rich text editor */
.Draftail-Editor__editor,
.tox-tinymce {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
}

/* Kill Wagtail's giant gap utilities on form containers */
.w-field__input {
  margin-top: 0 !important;
  padding: 0 !important;
}

[class*="w-mt-"],
[class*="w-mb-"] {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ── Buttons ─────────────────────────────────────── */
/* Primary buttons */
.button,
.w-action-more,
input[type="submit"],
.button-longrunning {
  background: linear-gradient(135deg, #0891b2, #0ea5e9) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 0.45rem 1rem !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 2px 6px rgba(8,145,178,0.25) !important;
  transition: all 0.15s ease !important;
}

.button:hover,
input[type="submit"]:hover,
.button-longrunning:hover {
  background: linear-gradient(135deg, #0e7490, #0284c7) !important;
  box-shadow: 0 4px 10px rgba(8,145,178,0.3) !important;
  transform: translateY(-1px);
}

/* Secondary buttons */
.button-secondary,
.button--secondary,
.button.button-secondary,
.button.button--secondary,
.button.no,
.button.button-small.button-secondary {
  background: #ffffff !important;
  color: #0891b2 !important;
  border: 1.5px solid #cffafe !important;
  box-shadow: none !important;
}

.button-secondary:hover,
.button--secondary:hover {
  background: #ecfeff !important;
  color: #0e7490 !important;
  border-color: #67e8f9 !important;
}

/* Don't style inline icon buttons as primary */
.w-panel__header button,
.w-field button,
button.c-sf-button,
button[data-chooser-action-button],
.chooser button,
button.action-choose,
.w-dismissible button,
.w-userbar button,
button.w-slim-header__button,
button[aria-label] {
  background: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0.25rem !important;
  min-height: 0 !important;
}

/* Action bar / footer – right aligned */
.footer {
  left: auto !important;
  right: 24px !important;
  margin-inline-start: auto !important;
  margin-inline-end: 0 !important;
  text-align: right !important;
}

.w-action-bar,
footer .actions,
.footer .actions,
.footer__container {
  background: #1e293b !important;
  border-top: 1px solid #334155;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  padding: 10px 24px !important;
  border-radius: 10px 10px 0 0 !important;
}

.footer .actions ul,
footer .actions ul,
.w-action-bar ul {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.w-action-bar .button,
footer .actions .button,
.footer .actions .button {
  background: linear-gradient(135deg, #0891b2, #38bdf8) !important;
  color: #fff !important;
  border-radius: 8px !important;
  padding: 10px 32px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 2px 8px rgba(8,145,178,0.3) !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
}

.w-action-bar .button:hover,
footer .actions .button:hover,
.footer .actions .button:hover {
  background: linear-gradient(135deg, #0e7490, #0ea5e9) !important;
  box-shadow: 0 4px 14px rgba(8,145,178,0.4) !important;
  transform: translateY(-1px);
}

/* Dropdown toggle */
.w-dropdown-button .button.w-dropdown__toggle {
  background: #0e7490 !important;
}

.w-dropdown-button .button.w-dropdown__toggle:is(:hover,:focus-visible) {
  background: #155e75 !important;
}

/* ── Tables / Listings ───────────────────────────── */
.listing,
.listing.full-width,
.w-table {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.listing th,
.w-table th {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
}

.listing td,
.w-table td {
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
}

.listing tbody tr:hover,
.w-table tbody tr:hover {
  background: #f8fafc;
}

.listing .title .title-wrapper,
.listing .title h2 {
  color: #2563eb;
  font-weight: 600;
}

/* Page status tags */
.w-status {
  font-size: 0.7rem;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

/* ── Tabs ────────────────────────────────────────── */
.w-tabs__tab,
.tab-nav a,
[role="tab"] {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-radius: 6px !important;
  padding: 0.3rem 0.7rem !important;
  font-size: 0.82rem !important;
  margin-right: 0.2rem !important;
  border: none !important;
}

.w-tabs__tab:hover,
.tab-nav a:hover,
[role="tab"]:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}

.w-tabs__tab[aria-selected="true"],
.tab-nav .active a,
[role="tab"][aria-selected="true"] {
  background: linear-gradient(135deg, #0891b2, #0ea5e9) !important;
  color: #ffffff !important;
}

/* ── Messages / Alerts ───────────────────────────── */
.w-message,
.messages .success,
.messages .error,
.messages .warning {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-size: 0.85rem;
}

/* ── Dashboard / Home ────────────────────────────── */
.w-summary__list {
  gap: 0.75rem;
}

.w-summary__item .icon {
  color: #2563eb;
}

.w-summary__item a {
  color: #1e293b;
  font-weight: 500;
}

.w-summary__item a:hover {
  color: #2563eb;
}

/* ── Chooser widgets ─────────────────────────────── */
.chooser {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}

.chooser .chosen {
  font-size: 0.82rem;
}

.chooser .action-choose,
.chooser .action-clear {
  font-size: 0.78rem;
}

/* ── Minimap (right-side navigation) ─────────────── */
.w-minimap {
  font-size: 0.75rem;
}

/* ── Login page ──────────────────────────────────── */
.login {
  background: #0f172a !important;
}

.login .content-wrapper {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07);
  padding: 2rem;
  max-width: 400px;
}

.login h1,
.login .branding {
  color: #1e293b !important;
  font-weight: 700;
  font-size: 1.25rem;
  text-align: center;
}

.login .w-field__label {
  color: #1e293b;
}

.login .button,
.login input[type="submit"] {
  width: 100%;
}

/* ── Responsive ──────────────────────────────────── */
/* ── Hide sidebar search box ─────────────────────── */
[data-sidebar-search],
.sidebar-search {
  display: none !important;
}

@media (max-width: 50em) {
  .w-sidebar,
  .sidebar {
    box-shadow: none;
  }

  .w-panel {
    padding: 0.4rem 0.75rem !important;
  }
}

/* ── CTA / action buttons – icon + text alignment ── */
.button .icon,
.button svg,
.button-longrunning .icon,
.button-longrunning svg,
a.button .icon,
a.button svg {
  display: inline-block !important;
  vertical-align: middle !important;
  margin-right: 6px !important;
  width: 1em !important;
  height: 1em !important;
  position: relative !important;
  top: -1px !important;
}

.button .button__label,
.button span {
  vertical-align: middle !important;
}

/* Upload / chooser CTA buttons */
.chooser__actions .button,
.action-choose,
.action-clear,
[data-chooser-action-button] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* ── Sidebar toggle button (collapse/expand) ─────── */
.sidebar-toggle,
.sidebar__collapse-toggle,
button[data-sidebar-toggle],
button.w-slim-header__button,
.sidebar button[aria-label],
.sidebar > button:first-child,
[aria-label="Toggle sidebar"] {
  color: #67e8f9 !important;
  opacity: 1 !important;
  background: rgba(255,255,255,0.08) !important;
  border-radius: 6px !important;
}

.sidebar-toggle:hover,
button[data-sidebar-toggle]:hover,
.sidebar button[aria-label]:hover,
[aria-label="Toggle sidebar"]:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.15) !important;
}

.sidebar-toggle svg,
.sidebar__collapse-toggle svg,
button[data-sidebar-toggle] svg,
.sidebar button[aria-label] svg,
[aria-label="Toggle sidebar"] svg {
  color: #67e8f9 !important;
  fill: currentColor !important;
  width: 20px !important;
  height: 20px !important;
}
