/* =============================================================================
   Casa Vergara Resort - dark mode fixes (loaded LAST on every themed page).
   Switched by <html data-theme="dark"> (see js/theme.js).

   1. Mobile hamburger button was invisible: Bootstrap 5.3 already turns the
      icon white under data-bs-theme="dark", and theme.css then applied
      filter: invert(1) on top, flipping it back to black on a dark button.
   2. Muted text, success/danger text, .text-dark on yellow badges, primary
      buttons and calendar "other month" days were below WCAG AA contrast.
   3. Admin > Reports spreadsheet (styled from JS with hard-coded #fff) and a
      few inline-styled light surfaces stayed white in dark mode.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. Hamburger (mobile navbar toggler)
   ------------------------------------------------------------------------ */
html[data-theme="dark"] .site-navbar .navbar-toggler.nav-toggler-clean,
html[data-theme="dark"] .navbar-toggler.nav-toggler-clean {
  background: #1d3042 !important;
  border: 1.5px solid #5d7b96 !important;
  color: #f1f6fb !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
  opacity: 1 !important;
}
html[data-theme="dark"] .navbar-toggler.nav-toggler-clean:hover {
  background: #26405a !important;
  border-color: #7fb6e0 !important;
}
html[data-theme="dark"] .navbar-toggler.nav-toggler-clean:focus,
html[data-theme="dark"] .navbar-toggler.nav-toggler-clean:focus-visible {
  outline: 0;
  border-color: #8cc4ee !important;
  box-shadow: 0 0 0 3px rgba(90, 169, 222, 0.45) !important;
}
html[data-theme="dark"] .navbar-toggler.nav-toggler-clean[aria-expanded="true"] {
  background: #2a4a68 !important;
  border-color: #8cc4ee !important;
}
/* explicit light bars; no filter, so nothing can double-invert */
html[data-theme="dark"] .navbar-toggler .navbar-toggler-icon,
html[data-theme="dark"] .nav-toggler-clean .navbar-toggler-icon {
  --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23f1f6fb' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.6' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-image: var(--bs-navbar-toggler-icon-bg) !important;
  filter: none !important;
  opacity: 1 !important;
  width: 1.6em;
  height: 1.6em;
}
/* admin/staff toolbar icon buttons */
html[data-theme="dark"] body .admin-icon-btn {
  background: #1d3042 !important;
  border-color: #5d7b96 !important;
  color: #f1f6fb !important;
}
html[data-theme="dark"] body .admin-icon-btn .bi,
html[data-theme="dark"] body .admin-icon-btn i { color: #f1f6fb !important; }
html[data-theme="dark"] body .admin-icon-btn:hover { background: #26405a !important; }

/* ---------------------------------------------------------------------------
   2. Text colours that were too dim on dark surfaces
   ------------------------------------------------------------------------ */
/* style.css pins .admin-main .text-muted-brand to #5b6875 with higher specificity */
html[data-theme="dark"] .admin-main .text-muted-brand,
html[data-theme="dark"] .admin-main p.text-muted-brand,
html[data-theme="dark"] .admin-main .text-muted-brand.mb-4,
html[data-theme="dark"] .admin-main p.text-muted-brand.mb-0,
html[data-theme="dark"] .admin-main .text-muted,
html[data-theme="dark"] .admin-wrap .text-muted-brand,
html[data-theme="dark"] .landing-hero .text-muted-brand,
html[data-theme="dark"] body .text-muted-brand,
html[data-theme="dark"] body .text-muted,
html[data-theme="dark"] body .text-secondary,
html[data-theme="dark"] body .text-body-secondary { color: #a3b5c6 !important; }

/* semantic text */
html[data-theme="dark"] body .text-success,
html[data-theme="dark"] body strong.text-success,
html[data-theme="dark"] body small.text-success { color: #5fd38d !important; }
html[data-theme="dark"] body .text-danger,
html[data-theme="dark"] body strong.text-danger,
html[data-theme="dark"] body small.text-danger { color: #ff8a95 !important; }
html[data-theme="dark"] body .text-warning { color: #f2cf4a !important; }
html[data-theme="dark"] body .text-info { color: #6cc4ee !important; }

/* .text-dark is forced light in dark mode, which breaks it on yellow/cyan/light chips */
html[data-theme="dark"] body .bg-warning,
html[data-theme="dark"] body .bg-warning.text-dark,
html[data-theme="dark"] body .bg-warning .text-dark,
html[data-theme="dark"] body .badge.bg-warning,
html[data-theme="dark"] body .badge.text-bg-warning,
html[data-theme="dark"] body .text-bg-warning,
html[data-theme="dark"] body .btn-warning,
html[data-theme="dark"] body .bg-info.text-dark,
html[data-theme="dark"] body .badge.bg-info,
html[data-theme="dark"] body .text-bg-info,
html[data-theme="dark"] body .bg-accent,
html[data-theme="dark"] body .badge.bg-accent { color: #1f2328 !important; }

/* primary buttons: white text on #2f86bd was 3.99:1, now >= 4.8:1 */
html[data-theme="dark"] body .btn-brand,
html[data-theme="dark"] body .btn-primary {
  background: #2878ad !important;
  border-color: #2878ad !important;
  color: #fff !important;
}
html[data-theme="dark"] body .btn-brand:hover,
html[data-theme="dark"] body .btn-brand:focus,
html[data-theme="dark"] body .btn-primary:hover,
html[data-theme="dark"] body .btn-primary:focus {
  background: #1f6a9b !important;
  border-color: #1f6a9b !important;
  color: #fff !important;
}
html[data-theme="dark"] body .btn-brand:disabled,
html[data-theme="dark"] body .btn-brand.disabled { opacity: 0.55; }

/* small blue chips / counters */
html[data-theme="dark"] body .cvr-time-flex-badge,
html[data-theme="dark"] body .sitemap-group-count { color: #8fc9ee !important; }
html[data-theme="dark"] body .sitemap-stat-sep { color: #6f8499 !important; }

/* calendar: days from the neighbouring month stay dimmed but legible
   (token lives in calendars.css; that sheet also fades them to 60% opacity) */
html[data-theme="dark"]:not(.cvr-x):not(.cvr-y) body .booking-cal-mini-day--muted {
  color: #8497ab !important;
  opacity: 1;
}

/* links inside body copy / cards */
html[data-theme="dark"] body .soft-card a:not(.btn):not(.nav-link):not(.dropdown-item),
html[data-theme="dark"] body .legal-doc a,
html[data-theme="dark"] body .faq-answer a { color: #8fc9ee; }

/* browser autofill (login / register / checkout) keeps the dark field */
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill {
  -webkit-text-fill-color: #e6edf4 !important;
  caret-color: #e6edf4;
  box-shadow: 0 0 0 1000px #1b2835 inset !important;
  transition: background-color 9999s ease-out 0s;
}

/* ---------------------------------------------------------------------------
   3. Surfaces that stayed white
   ------------------------------------------------------------------------ */
/* Payment page note + team photo placeholder have inline light backgrounds */
html[data-theme="dark"] body .payment-note-card {
  background: #14293b !important;
  border-color: #1f4463 !important;
  color: #cfe3f3 !important;
}
html[data-theme="dark"] body #teamEditPhotoEmpty,
html[data-theme="dark"] body #teamViewPhoto { background: #1b2835 !important; }

/* Admin > Reports spreadsheet (styles are injected by js/admin-export.js) */
html[data-theme="dark"] .cvr-sheet { color: #d5e0ea; }
html[data-theme="dark"] .cvr-sheet .cvr-sheet-fields {
  background: #1b2835;
  border-color: #2a3b4b;
}
html[data-theme="dark"] .cvr-sheet .cvr-sheet-fields label { color: #d5e0ea; }
html[data-theme="dark"] .cvr-sheet .cvr-paper {
  background: #16212c;
  border-color: #2a3b4b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .cvr-sheet .cvr-report-head {
  background: linear-gradient(180deg, #16212c 0%, #1b2835 100%);
  border-bottom-color: #d9b312;
}
html[data-theme="dark"] .cvr-sheet .cvr-report-brand img {
  background: #fff;
  border-color: #2a3b4b;
}
html[data-theme="dark"] .cvr-sheet .cvr-report-brand .rn { color: #e6edf4; }
html[data-theme="dark"] .cvr-sheet .cvr-report-brand .rt { color: #8fc9ee; }
html[data-theme="dark"] .cvr-sheet .cvr-report-meta { color: #c6d3df; }
html[data-theme="dark"] .cvr-sheet .cvr-report-meta strong { color: #e6edf4; }
html[data-theme="dark"] .cvr-sheet .cvr-formula {
  background: #16212c;
  border-bottom-color: #2a3b4b;
  color: #d5e0ea;
}
html[data-theme="dark"] .cvr-sheet .cvr-formula .nm {
  background: #1b2835;
  border-right-color: #2a3b4b;
  color: #a5d0f0;
}
html[data-theme="dark"] .cvr-sheet .cvr-formula .fx {
  border-right-color: #2a3b4b;
  color: #8fc9ee;
}
html[data-theme="dark"] .cvr-sheet .cvr-sheet-scroll { background: #16212c; }
html[data-theme="dark"] .cvr-sheet table.cvr-grid th,
html[data-theme="dark"] .cvr-sheet table.cvr-grid td {
  border-right-color: #263646;
  border-bottom-color: #263646;
}
html[data-theme="dark"] .cvr-sheet table.cvr-grid thead tr:first-child th,
html[data-theme="dark"] .cvr-sheet table.cvr-grid th.rowhead {
  background: #1b2835;
  color: #9db0c3;
}
html[data-theme="dark"] .cvr-sheet table.cvr-grid td {
  background: #16212c;
  color: #d5e0ea;
}
html[data-theme="dark"] .cvr-sheet table.cvr-grid td.hdr {
  background: #1c5780;
  color: #fff;
  border-right-color: rgba(255, 255, 255, 0.14);
  border-bottom-color: #1c5780;
}
html[data-theme="dark"] .cvr-sheet table.cvr-grid tbody tr:nth-child(even) td { background: #182533; }
html[data-theme="dark"] .cvr-sheet table.cvr-grid tbody tr:hover td { background: #1f3042; }
html[data-theme="dark"] .cvr-sheet table.cvr-grid td.sel {
  outline-color: #5aa9de;
  background: #20384f !important;
}
html[data-theme="dark"] .cvr-sheet table.cvr-grid th.active {
  background: #24415b !important;
  color: #e6edf4;
}
html[data-theme="dark"] .cvr-sheet .cvr-sheet-foot {
  background: #1b2835;
  border-top-color: #2a3b4b;
  color: #c6d3df;
}
html[data-theme="dark"] .cvr-sheet .cvr-sheet-foot .tab {
  background: #16212c;
  color: #e6edf4;
  border-left-color: #2a3b4b;
  border-right-color: #2a3b4b;
  border-bottom-color: #5aa9de;
}

/* ---------------------------------------------------------------------------
   4. Calendar status pills + pagination (found by the component audit)
   ------------------------------------------------------------------------ */
html[data-theme="dark"]:not(.cvr-x):not(.cvr-y) body .booking-cal-pill--cancelled {
  color: #ffb3b3 !important;
  background: rgba(240, 110, 105, 0.22) !important;
}
html[data-theme="dark"]:not(.cvr-x):not(.cvr-y) body .booking-cal-pill--pay-no {
  color: #b4c3d1 !important;
}
html[data-theme="dark"] body .page-item.active .page-link,
html[data-theme="dark"] body .pagination .active > .page-link {
  background: #2878ad !important;
  border-color: #2878ad !important;
  color: #fff !important;
}
