/* mod_cruise_finder — self-contained styles, no framework dependency.
   All classes prefixed cf- to avoid collisions with Cassiopeia/Bootstrap. */

.cf-finder {
  --cf-accent: #0f6e5c;
  --cf-accent-dark: #0b4f42;
  --cf-border: #e0e0e0;
  --cf-bg-muted: #f7f7f5;
  --cf-text: #222;
  --cf-text-muted: #6b6b6b;
  --cf-radius: 10px;
  font-family: inherit;
  color: var(--cf-text);
}

.cf-loading {
  padding: 2rem;
  text-align: center;
  color: var(--cf-text-muted);
}

/* Layout: filters as a sidebar on wide screens, collapsible panel on mobile.
   Filters and results are independently scrollable boxes on desktop (not
   position:sticky — that depends on ancestor overflow/height behavior we
   don't control inside Cassiopeia, and quietly breaks if any ancestor sets
   overflow to something other than visible). A fixed max-height with its
   own overflow-y is self-contained and works regardless of the page around it. */
.cf-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 780px) {
  .cf-layout {
    grid-template-columns: 1fr;
  }
}

/* Filters panel */
.cf-filters {
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius);
  padding: 1rem;
  background: #fff;
}

@media (min-width: 781px) {
  .cf-filters {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  /* .cf-results deliberately has NO height cap — it should size to however
     many cards actually match, not to a fixed viewport fraction. Capping
     it artificially shrank the module's total footprint whenever a filter
     narrowed results down, which — combined with Cassiopeia's sticky-footer
     layout — showed up as unwanted empty space above the footer. */
}

@media (max-width: 780px) {
  .cf-filters {
    position: static;
  }
}

.cf-filters-toggle {
  display: none;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.75rem;
}

@media (max-width: 780px) {
  .cf-filters-toggle {
    display: block;
  }
  .cf-filters-body {
    display: none;
  }
  .cf-filters.cf-filters-open .cf-filters-body {
    display: block;
  }
}

.cf-filter-group {
  margin-bottom: 1.1rem;
}

.cf-filter-group:last-child {
  margin-bottom: 0;
}

.cf-filter-group h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cf-text-muted);
  margin: 0 0 0.5rem;
}

.cf-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cf-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--cf-border);
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
  background: #fff;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cf-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cf-pill.cf-pill-active {
  background: var(--cf-accent);
  border-color: var(--cf-accent);
  color: #fff;
}

.cf-pill-count {
  opacity: 0.7;
  font-size: 0.75em;
}

.cf-range-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--cf-text-muted);
  margin-bottom: 0.3rem;
}

/* Two overlapping native range inputs made to look and behave like one
   control: a static track + a highlighted segment between the two
   thumbs (positioned by JS via left/right %), with the inputs themselves
   transparent and click-through except at the thumb itself. Real
   crossing-prevention happens in JS (each input's value is clamped in
   real time); this is purely the visual layer that makes it read as one
   slider instead of two stacked bars. */
.cf-dual-range {
  position: relative;
  height: 28px;
  margin-top: 0.3rem;
}

.cf-dual-range-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  transform: translateY(-50%);
  background: var(--cf-border);
  border-radius: 999px;
}

.cf-dual-range-highlight {
  position: absolute;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  background: var(--cf-accent);
  border-radius: 999px;
}

.cf-dual-range input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  margin: 0;
  height: 28px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.cf-dual-range input[type="range"]::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  background: none;
}

.cf-dual-range input[type="range"]::-moz-range-track {
  background: none;
}

.cf-dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cf-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cf-border);
  cursor: pointer;
  margin-top: 6px;
}

.cf-dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cf-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cf-border);
  cursor: pointer;
}

.cf-rating-select,
.cf-sort-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--cf-border);
  border-radius: 6px;
  font-size: 0.88rem;
}

.cf-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.cf-reset-btn {
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.5rem;
  border: 1px solid var(--cf-border);
  border-radius: 6px;
  background: var(--cf-bg-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.cf-reset-btn:hover {
  background: #eee;
}

/* Results area */
.cf-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.cf-count {
  font-size: 0.9rem;
  color: var(--cf-text-muted);
}

.cf-sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.cf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.cf-card {
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius);
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.cf-card.cf-card-unavailable {
  opacity: 0.6;
}

/* Image sits flush with the card's top edge despite the card's own
   padding, via negative margins matching that padding exactly. Now an
   <a> (for the image-is-a-link requirement), so needs display:block —
   anchors are inline by default and won't size correctly otherwise. */
.cf-card-image {
  position: relative;
  display: block;
  margin: -1rem -1rem 0 -1rem;
  aspect-ratio: 16 / 10;
  border-radius: var(--cf-radius) var(--cf-radius) 0 0;
  overflow: hidden;
  background: var(--cf-bg-muted);
}

.cf-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cf-card-image-placeholder {
  background: linear-gradient(135deg, var(--cf-bg-muted), #ececec);
}

.cf-image-badge {
  position: absolute;
  top: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--cf-text);
  white-space: nowrap;
}

.cf-image-badge-type {
  left: 0.5rem;
}

.cf-image-badge-unavailable {
  right: 0.5rem;
  background: rgba(163, 51, 51, 0.92);
  color: #fff;
}

.cf-image-badge-ship {
  right: 0.5rem;
}

.cf-schedule-row,
.cf-beverage-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--cf-text-muted);
}

.cf-schedule-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cf-beverage-row {
  gap: 0.5rem;
}

.cf-beverage-row i {
  font-size: 0.95rem;
  color: var(--cf-accent-dark);
}

.cf-beverage-note {
  font-size: 0.78rem;
  color: var(--cf-text-muted);
}

.cf-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.cf-card-title a {
  color: var(--cf-accent-dark);
  text-decoration: none;
}

.cf-card-title a:hover {
  text-decoration: underline;
}

.cf-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* Piers get their own visual group, separated from feature badges with
   extra margin rather than a forced line break — keeps compact cards
   compact, while still reading as "location" distinctly from "features". */
.cf-pier-badge-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-right: 0.6rem;
}

.cf-badge-pier {
  background: var(--cf-accent);
  color: #fff;
  font-weight: 600;
}

.cf-badge-pier i {
  margin-right: 0.15rem;
}

.cf-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--cf-bg-muted);
  color: var(--cf-text);
  white-space: nowrap;
}

.cf-badge-unavailable {
  background: #fdeaea;
  color: #a33;
}

.cf-badge-partial {
  background: #fff4d9;
  color: #8a6300;
}

.cf-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.2rem;
}

.cf-price {
  font-size: 1.1rem;
  font-weight: 700;
}

.cf-rating {
  font-size: 0.85rem;
  color: var(--cf-text-muted);
}

.cf-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.4rem;
  border-top: 1px solid var(--cf-border);
}

.cf-compare-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.cf-view-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cf-accent-dark);
  text-decoration: none;
}

.cf-view-link:hover {
  text-decoration: underline;
}

.cf-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--cf-text-muted);
  border: 1px dashed var(--cf-border);
  border-radius: var(--cf-radius);
}

/* Sticky compare bar */
.cf-compare-bar {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  background: var(--cf-accent-dark);
  color: #fff;
  border-radius: var(--cf-radius);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

.cf-compare-bar.cf-compare-bar-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cf-compare-bar-text {
  font-size: 0.9rem;
}

.cf-compare-bar a.cf-compare-cta {
  background: #fff;
  color: var(--cf-accent-dark);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.cf-compare-bar a.cf-compare-cta.cf-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.cf-compare-clear {
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}
