/* mod_cruise_compare — self-contained styles, no framework dependency.
   All classes prefixed cc- (independent from mod_cruise_finder's cf-
   prefix, since these are separate modules that shouldn't assume the
   other's CSS is loaded on the same page). */

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

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

.cc-guidance {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--cc-border);
  border-radius: var(--cc-radius);
  color: var(--cc-text-muted);
}

.cc-guidance p {
  margin: 0 0 1rem;
}

.cc-guidance a.cc-guidance-cta {
  display: inline-block;
  background: var(--cc-accent);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}

.cc-guidance a.cc-guidance-cta:hover {
  background: var(--cc-accent-dark);
}

.cc-note {
  font-size: 0.85rem;
  color: var(--cc-text-muted);
  margin-bottom: 0.75rem;
}

/* Horizontal scroll wrapper for narrow screens — the sticky first column
   works because ITS containing block is this scroll container directly,
   not some remote page ancestor, so it doesn't share the fragility that
   vertical position:sticky had inside the page's own scroll earlier. */
.cc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
}

.cc-table {
  border-collapse: collapse;
  width: 100%;
  /* Fixed layout is what actually makes columns equal width — without
     it, the browser auto-sizes each column to its own content (in this
     case, each cruise's natural image dimensions before object-fit even
     applies), which is why columns were visibly uneven before. With
     fixed layout, only the first row's cell widths matter; the row-label
     column gets an explicit width below, and every cruise column (left
     unset) shares the remaining space equally. */
  table-layout: fixed;
}

.cc-table th,
.cc-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--cc-border);
  vertical-align: top;
  text-align: left;
  font-size: 0.88rem;
  overflow-wrap: break-word;
}

.cc-table tbody tr:last-child th,
.cc-table tbody tr:last-child td {
  border-bottom: none;
}

.cc-table tfoot td {
  border-top: 2px solid var(--cc-border);
  border-bottom: none;
  text-align: center;
  padding: 1rem 0.75rem;
}

.cc-row-label {
  position: sticky;
  left: 0;
  background: #fff;
  font-weight: 600;
  width: 130px;
  border-right: 1px solid var(--cc-border);
  z-index: 1;
}

.cc-col-header {
  position: relative;
}

.cc-remove-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--cc-border);
  background: #fff;
  color: var(--cc-text-muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-remove-btn:hover {
  background: #fdeaea;
  color: #a33;
  border-color: #a33;
}

/* The remove button's actual positioning anchor — sized to exactly the
   image, not the surrounding card's padding box. Fixes the button
   drifting away from the image's corner after the image itself lost
   its old bleed-to-edge negative margins. */
.cc-image-frame {
  position: relative;
}

.cc-cruise-image-wrap {
  display: block;
  margin: 0 0 0.6rem 0;
  aspect-ratio: 16 / 10;
  border-radius: var(--cc-radius);
  overflow: hidden;
  background: var(--cc-bg-muted);
}

.cc-cruise-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.cc-cruise-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
  line-height: 1.3;
}

/* "This Cruise" now lives as a badge on the image (instead of inline
   next to the title, which wrapped awkwardly on longer titles) and as
   plain non-link text where "View details" used to sit — so that cell
   isn't just blank whitespace once the self-link was removed. */
.cc-image-badge-current {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--cc-accent);
  color: #fff;
  white-space: nowrap;
}

.cc-current-cta {
  display: inline-block;
  color: var(--cc-text-muted);
  font-weight: 600;
  font-style: italic;
}

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

.cc-cruise-title a:hover {
  text-decoration: underline;
}

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

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

.cc-price {
  font-size: 1rem;
  font-weight: 700;
}

.cc-rating {
  color: var(--cc-text-muted);
}

/* "Winner" accent — lowest price, highest rating, or best-ranked dining
   type among the compared cruises, only shown when they actually differ
   (see computeWinners() in JS; ties show no accent at all). */
.cc-winner-value {
  color: var(--cc-accent-dark);
}

.cc-winner-badge {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--cc-accent);
  color: #fff;
  vertical-align: middle;
}

.cc-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

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

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

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

.cc-beverage-icons i {
  font-size: 0.95rem;
  color: var(--cc-accent-dark);
  margin-right: 0.4rem;
}

.cc-beverage-note {
  display: block;
  font-size: 0.78rem;
  color: var(--cc-text-muted);
  margin-top: 0.3rem;
}

.cc-availability-ok {
  color: var(--cc-accent-dark);
  font-weight: 600;
}

.cc-availability-bad {
  color: #a33;
  font-weight: 600;
}

.cc-empty-cell {
  color: var(--cc-text-muted);
}

.cc-add-more {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.88rem;
}

.cc-add-more a {
  color: var(--cc-accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.cc-add-more a:hover {
  text-decoration: underline;
}

/* -----------------------------------------------------------------
   Mobile layouts. Two different treatments depending on cruise count:
   exactly 2 → a stacked "label row, then 2-column value row" layout
   that needs no horizontal scrolling at all, since 2 columns fit any
   screen. 3+ → the same desktop table, made horizontally snap-scrolling
   with roughly 2 cruise columns visible at a time (a swipeable
   "carousel" rather than a cramped 3-up squeeze or a totally different
   layout just for the 3-cruise case).
   ----------------------------------------------------------------- */

.cc-mobile-stack {
  display: none;
}

.cc-swipe-hint {
  display: none;
}

@media (max-width: 780px) {
  /* Exactly 2 cruises: hide the table, show the stack instead. */
  .cc-count-2 .cc-table-wrap {
    display: none;
  }
  .cc-count-2 .cc-mobile-stack {
    display: block;
  }

  /* 3+ cruises: the sticky label column + scroll-snap-align on cruise
     columns fought over the same "start of scroll container" position
     (sticky always wins, rendering on top of whatever snapped there) —
     a fundamental conflict, not a tunable one. Replaced with self-
     contained swipeable cards instead (see .cc-mobile-carousel below);
     the table itself is simply hidden on mobile for 3+ cruises. */
  .cc-count-multi .cc-table-wrap {
    display: none;
  }
  .cc-count-multi .cc-mobile-carousel {
    display: flex;
  }
  .cc-count-multi .cc-swipe-hint {
    display: block;
    text-align: center;
    font-size: 0.82rem;
    color: var(--cc-accent-dark);
    font-weight: 600;
    margin-top: 0.6rem;
    animation: cc-swipe-pulse 1.6s ease-in-out infinite;
  }
}

@keyframes cc-swipe-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.cc-mobile-headers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cc-mobile-header-col {
  position: relative;
}

.cc-mobile-metric-label {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--cc-text-muted);
  padding: 0.6rem 0 0.3rem;
  border-top: 1px solid var(--cc-border);
}

.cc-mobile-headers + .cc-mobile-metric-label {
  border-top: none;
}

.cc-mobile-value-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.cc-mobile-value {
  font-size: 0.88rem;
}

.cc-mobile-cta-row {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--cc-border);
}

.cc-mobile-cta-row .cc-view-link {
  display: inline-block;
}

/* Booking CTA — deliberately styled as a solid, higher-contrast button
   distinct from the lighter "View details" text link, since this is the
   stronger transactional action (skip the article page, go straight to
   the affiliate booking link). */
.cc-book-btn {
  display: block;
  width: fit-content;
  margin: 0 auto;
  background: var(--cc-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
}

.cc-book-btn:hover {
  background: var(--cc-accent-dark);
  color: #fff;
}

.cc-mobile-book-row {
  margin-top: 0.5rem;
}

.cc-carousel-cta {
  margin-bottom: 0.5rem;
}

.cc-mobile-carousel {
  display: none;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
  /* Deliberately no sticky element inside this carousel — each card is
     fully self-contained, which is what avoids the sticky/snap conflict
     the frozen-label table approach ran into. */
}

.cc-carousel-card {
  position: relative;
  flex: 0 0 85vw;
  scroll-snap-align: start;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 0.9rem;
  background: #fff;
}

.cc-carousel-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--cc-border);
  font-size: 0.85rem;
}

.cc-carousel-row:first-of-type {
  border-top: none;
}

.cc-carousel-label {
  font-weight: 600;
  color: var(--cc-text-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

.cc-carousel-value {
  text-align: right;
}

.cc-carousel-cta {
  display: block;
  text-align: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--cc-border);
}

/* Dropdown pickers (standalone page, <2 valid cruises) and the
   article-embed "compare with a different cruise" switcher. */
.cc-picker-guidance p {
  margin: 0 0 1rem;
  color: var(--cc-text);
  font-weight: 600;
}

.cc-picker-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.cc-picker-select,
.cc-switch-select,
.cc-add-select {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--cc-border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fff;
  color: var(--cc-text);
  min-width: 180px;
}

.cc-picker-submit {
  background: var(--cc-accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.cc-picker-submit:hover {
  background: var(--cc-accent-dark);
}

.cc-picker-error {
  color: #a33;
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

.cc-picker-add-more {
  margin-bottom: 1rem;
}

.cc-picker-add-btn {
  background: none;
  border: 1px dashed var(--cc-border);
  color: var(--cc-accent-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.cc-picker-add-btn:hover {
  background: var(--cc-bg-muted);
}

.cc-page-heading {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

.cc-embed-heading {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.cc-embed-switcher {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.88rem;
}


