/* ==========================================================================
   Night for the pages that have no night design of their own: the account and admin pages and the
   older public pages. Their <html> carries data-tw-bs-dark, so at night the theme switch also puts
   Bootstrap in its dark mode (data-bs-theme="dark", see Views/Shared/_ThemeHead.cshtml and
   js/theme-toggle.js). Bootstrap's own dark greys are replaced here by the winter night palette of
   css/theme-night.css (--n-*): deep blue, snow-white text, ice-blue links, the brand lime unchanged.
   ========================================================================== */

html[data-theme="dark"][data-tw-bs-dark] {
  color-scheme: dark;
  --bs-body-bg: #0b1a2a;
  --bs-body-bg-rgb: 11, 26, 42;
  --bs-body-color: #e9f2f9;
  --bs-body-color-rgb: 233, 242, 249;
  --bs-emphasis-color: #ffffff;
  --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-secondary-color: rgba(222, 235, 245, 0.7);
  --bs-secondary-bg: #11253b;
  --bs-secondary-bg-rgb: 17, 37, 59;
  --bs-tertiary-color: rgba(222, 235, 245, 0.48);
  --bs-tertiary-bg: #183450;
  --bs-tertiary-bg-rgb: 24, 52, 80;
  --bs-heading-color: #e9f2f9;
  --bs-border-color: rgba(160, 205, 235, 0.16);
  --bs-border-color-translucent: rgba(160, 205, 235, 0.16);
  --bs-link-color: #9fd4ef;
  --bs-link-color-rgb: 159, 212, 239;
  --bs-link-hover-color: #c9e8f8;
  --bs-link-hover-color-rgb: 201, 232, 248;
  --bs-gray-100: #11253b;
  --bs-gray-200: #183450;
  --bs-gray-300: rgba(160, 205, 235, 0.24);
}

/* Cards, panels, modals and tables in the night card colour */
html[data-theme="dark"][data-tw-bs-dark] .card,
html[data-theme="dark"][data-tw-bs-dark] .modal-content,
html[data-theme="dark"][data-tw-bs-dark] .offcanvas,
html[data-theme="dark"][data-tw-bs-dark] .list-group,
html[data-theme="dark"][data-tw-bs-dark] .accordion {
  --bs-card-bg: #11253b;
  --bs-card-cap-bg: rgba(255, 255, 255, 0.03);
  --bs-card-border-color: rgba(160, 205, 235, 0.16);
  --bs-modal-bg: #11253b;
  --bs-offcanvas-bg: #0d1f33;
  --bs-list-group-bg: #11253b;
  --bs-list-group-color: #e9f2f9;
  --bs-list-group-border-color: rgba(160, 205, 235, 0.16);
  --bs-accordion-bg: #11253b;
  --bs-accordion-color: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e9f2f9;
  --bs-table-border-color: rgba(160, 205, 235, 0.16);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-striped-color: #e9f2f9;
  --bs-table-hover-bg: rgba(159, 212, 239, 0.07);
  --bs-table-hover-color: #ffffff;
}

html[data-theme="dark"][data-tw-bs-dark] .table-light,
html[data-theme="dark"][data-tw-bs-dark] thead.table-light th {
  --bs-table-bg: #183450;
  --bs-table-color: #e9f2f9;
  --bs-table-border-color: rgba(160, 205, 235, 0.16);
}

/* White and light surfaces written as utilities or by hand */
html[data-theme="dark"][data-tw-bs-dark] .bg-white,
html[data-theme="dark"][data-tw-bs-dark] .bg-body,
html[data-theme="dark"][data-tw-bs-dark] .bg-mode {
  background-color: #11253b !important;
}

html[data-theme="dark"][data-tw-bs-dark] .bg-light {
  background-color: #183450 !important;
}

html[data-theme="dark"][data-tw-bs-dark] .text-dark,
html[data-theme="dark"][data-tw-bs-dark] .text-black {
  color: #e9f2f9 !important;
}

html[data-theme="dark"][data-tw-bs-dark] .text-muted,
html[data-theme="dark"][data-tw-bs-dark] .text-secondary,
html[data-theme="dark"][data-tw-bs-dark] .text-body-secondary {
  color: rgba(222, 235, 245, 0.7) !important;
}

html[data-theme="dark"][data-tw-bs-dark] .border,
html[data-theme="dark"][data-tw-bs-dark] .border-top,
html[data-theme="dark"][data-tw-bs-dark] .border-bottom,
html[data-theme="dark"][data-tw-bs-dark] .border-start,
html[data-theme="dark"][data-tw-bs-dark] .border-end {
  border-color: rgba(160, 205, 235, 0.16) !important;
}

/* Fields */
html[data-theme="dark"][data-tw-bs-dark] .form-control,
html[data-theme="dark"][data-tw-bs-dark] .form-select,
html[data-theme="dark"][data-tw-bs-dark] .input-group-text,
html[data-theme="dark"][data-tw-bs-dark] .choices__inner,
html[data-theme="dark"][data-tw-bs-dark] .choices__list--dropdown,
html[data-theme="dark"][data-tw-bs-dark] .choices__list[aria-expanded] {
  border-color: rgba(160, 205, 235, 0.2);
  background-color: rgba(255, 255, 255, 0.06);
  color: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .choices__list--dropdown,
html[data-theme="dark"][data-tw-bs-dark] .choices__list[aria-expanded] {
  background-color: #11253b;
}

html[data-theme="dark"][data-tw-bs-dark] .form-control:focus,
html[data-theme="dark"][data-tw-bs-dark] .form-select:focus {
  border-color: #9fd4ef;
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 0.25rem rgba(159, 212, 239, 0.14);
  color: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .form-control::placeholder {
  color: rgba(222, 235, 245, 0.45);
}

html[data-theme="dark"][data-tw-bs-dark] .form-control:disabled,
html[data-theme="dark"][data-tw-bs-dark] .form-control[readonly] {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Buttons that are light by day */
html[data-theme="dark"][data-tw-bs-dark] .btn-light,
html[data-theme="dark"][data-tw-bs-dark] .btn-white,
html[data-theme="dark"][data-tw-bs-dark] .btn-outline-secondary,
html[data-theme="dark"][data-tw-bs-dark] .btn-outline-dark {
  --bs-btn-bg: rgba(255, 255, 255, 0.06);
  --bs-btn-color: #e9f2f9;
  --bs-btn-border-color: rgba(160, 205, 235, 0.24);
  --bs-btn-hover-bg: rgba(159, 212, 239, 0.14);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-border-color: rgba(160, 205, 235, 0.4);
  --bs-btn-active-bg: rgba(159, 212, 239, 0.2);
  --bs-btn-active-color: #ffffff;
}

html[data-theme="dark"][data-tw-bs-dark] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Pagination and tabs */
html[data-theme="dark"][data-tw-bs-dark] .pagination {
  --bs-pagination-bg: #11253b;
  --bs-pagination-color: #e9f2f9;
  --bs-pagination-border-color: rgba(160, 205, 235, 0.16);
  --bs-pagination-hover-bg: #183450;
  --bs-pagination-hover-color: #ffffff;
  --bs-pagination-disabled-bg: #0d1f33;
  --bs-pagination-disabled-color: rgba(222, 235, 245, 0.4);
}

html[data-theme="dark"][data-tw-bs-dark] .nav-tabs {
  --bs-nav-tabs-border-color: rgba(160, 205, 235, 0.16);
  --bs-nav-tabs-link-active-bg: #11253b;
  --bs-nav-tabs-link-active-color: #ffffff;
  --bs-nav-tabs-link-active-border-color: rgba(160, 205, 235, 0.16);
}

/* The rich-text editor and the image drop zone */
html[data-theme="dark"][data-tw-bs-dark] .ql-toolbar,
html[data-theme="dark"][data-tw-bs-dark] .ql-container,
html[data-theme="dark"][data-tw-bs-dark] .dropzone {
  border-color: rgba(160, 205, 235, 0.2) !important;
  background-color: rgba(255, 255, 255, 0.04);
  color: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .ql-toolbar .ql-stroke {
  stroke: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .ql-toolbar .ql-fill {
  fill: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .ql-toolbar .ql-picker {
  color: #e9f2f9;
}

/* Page links painted light by the theme or a page; the current page keeps the brand lime */
html[data-theme="dark"][data-tw-bs-dark] .page-link {
  border-color: rgba(160, 205, 235, 0.16);
  background-color: #11253b;
  color: #e9f2f9;
}

html[data-theme="dark"][data-tw-bs-dark] .page-link:hover {
  background-color: #183450;
  color: #ffffff;
}

html[data-theme="dark"][data-tw-bs-dark] .page-item.active .page-link {
  background-color: #e5ee80;
  color: #0d1b2a;
}

html[data-theme="dark"][data-tw-bs-dark] .page-item.disabled .page-link {
  background-color: rgba(255, 255, 255, 0.04);
  color: rgba(222, 235, 245, 0.4);
}

/* Step labels written on the page (hotel profile, bid steps) */
html[data-theme="dark"][data-tw-bs-dark] .bs-stepper-label,
html[data-theme="dark"][data-tw-bs-dark] .step-label {
  color: rgba(222, 235, 245, 0.75) !important; /* the hotel profile writes #000 !important */
}

html[data-theme="dark"][data-tw-bs-dark] .step.active .bs-stepper-label,
html[data-theme="dark"][data-tw-bs-dark] .step.active .step-label {
  color: #ffffff !important;
}

/* Colours written straight into style="" attributes by some admin views (pagers, panels). Inline
   styles lose only to !important, so these carry it. */
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:#f0f0f0"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color: #f0f0f0"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background:#f8f9fa"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background: #f8f9fa"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:#f8f9fa"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color: #f8f9fa"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background:#f3f4f6"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:#f3f4f6"] {
  background-color: #183450 !important;
}

html[data-theme="dark"][data-tw-bs-dark] body [style*="background:#fff"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background: #fff"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:#fff"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color: #fff"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background:white"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background: white"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:white"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color: white"] {
  background-color: #11253b !important;
}

html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#555"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #555"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#6c757d"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #6c757d"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#6b7280"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #6b7280"] {
  color: rgba(222, 235, 245, 0.75) !important;
}

html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#333"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #333"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#111"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #111"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color:#000"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="color: #000"] {
  color: #e9f2f9 !important;
}

/* ...but text on the brand lime stays dark */
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color:#e5ee80"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background-color: #e5ee80"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background:#e5ee80"],
html[data-theme="dark"][data-tw-bs-dark] body [style*="background: #e5ee80"] {
  color: #0d1b2a !important;
}

/* ---------- The hotel and room pages (css/pages/hotel-detail.css) ----------
   Their text, lines and pale panels come from the page's own variables */
html[data-theme="dark"][data-tw-bs-dark] .hotel-detail {
  --tx: #e9f2f9;
  --tx2: rgba(222, 235, 245, 0.72);
  --bd: rgba(160, 205, 235, 0.16);
  --bd2: rgba(160, 205, 235, 0.12);
  --bg2: rgba(255, 255, 255, 0.04);
  --shadow: 0 28px 56px -30px rgba(0, 6, 14, 0.9);
}

/* "Get the best rate": a night card with a hint of lime, as by day */
html[data-theme="dark"][data-tw-bs-dark] .hotel-detail .hd-card--bid {
  background: linear-gradient(to bottom right, #11253b, #13283a 60%, rgba(229, 238, 128, 0.1));
}

/* The fade at the foot of a long description ends in the card's night colour */
html[data-theme="dark"][data-tw-bs-dark] .hotel-detail .hd-desc.is-collapsed .hd-desc__body::after {
  background: linear-gradient(transparent, #11253b);
}

/* Lime buttons and badges keep dark ink */
html[data-theme="dark"][data-tw-bs-dark] .hotel-detail .hd-btn--primary,
html[data-theme="dark"][data-tw-bs-dark] .hotel-detail .hd-btn--primary * {
  color: #0d1b2a;
}
