/*
 * simplecrm — WST module stylesheet
 *
 * Canonical source. Sites that use the WST module load this (and default.min.js);
 * non-WST sites skip both entirely. Published at:
 *   GET /api/v1/wst/default.css
 *   GET /api/v1/wst/default.js
 *
 * Consumers copy into their own static/ (e.g. via `make api-sync`) and own the
 * local copy. Re-fetching clobbers local edits — deliberate.
 *
 * Public class contract (rename = breaking change = new /api/v2/ endpoint):
 *   .crm-wst-grid, .crm-wst-tile*       — listing tiles (wstcollection, category[wst_tours])
 *   .crm-wst-detail*                    — WST auto-mode item detail page
 *   .crm-wst-cal*, .crm-wst-fare*, .crm-wst-sel*  — availability calendar / cart UI (default.js builds the DOM)
 */

/* ── WST collection / category (element types: wstcollection, category[wst_tours]) ── */
.crm-wst-grid {
  display: grid;
  grid-template-columns: repeat(var(--crm-wst-columns, 4), 1fr);
  gap: 1.25rem;
}

.crm-wst-tile {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.crm-wst-tile-image {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.crm-wst-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crm-wst-tile-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(14, 48, 86, 0.85);
  color: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

.crm-wst-tile-body {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.crm-wst-tile-title {
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: #0e3056;
}

.crm-wst-tile-location,
.crm-wst-tile-supplier {
  font-size: 0.85rem;
  color: #6b7280;
}

.crm-wst-tile-teaser {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.crm-wst-tile-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding-top: 0.5rem;
}

.crm-wst-tile-price-label {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
}

.crm-wst-tile-price-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #53ace0;
}

@media (max-width: 768px) {
  .crm-wst-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── WST product detail page ─────────────────────────────────
 * Rendered when /api/v1/page/resolve hits a category item slug that maps to
 * a WST auto-mode item. Works with default.js (availability calendar + cart).
 */
.crm-wst-detail {
  display: block;
}

.crm-wst-detail-hero {
  margin-bottom: 1.5rem;
}

.crm-wst-detail-hero img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.crm-wst-detail-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.crm-wst-detail-main {
  min-width: 0;
}

.crm-wst-detail-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: #0e3056;
}

.crm-wst-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.crm-wst-detail-badge {
  display: inline-block;
  background: #6b7280;
  color: #ffffff;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.crm-wst-detail-badge-duration {
  background: #111827;
}

.crm-wst-detail-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.crm-wst-detail-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.crm-wst-detail-price-label {
  font-weight: 600;
  color: #6b7280;
}

.crm-wst-detail-price-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #53ace0;
}

.crm-wst-detail-avail-btn {
  margin-left: auto;
  background: #f5c518;
  color: #000000;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 40px;
  cursor: pointer;
}

.crm-wst-detail-avail-btn:hover {
  background: #e3b617;
}

.crm-wst-detail-fare-row {
  margin-bottom: 0.75rem;
}

.crm-wst-detail-fare-label {
  font-size: 0.85rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

.crm-wst-detail-fare-select {
  max-width: 400px;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #ffffff;
  font-size: 0.9rem;
}

.crm-wst-detail-avail {
  margin-bottom: 1.25rem;
}

.crm-wst-detail-avail-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 1rem;
}

.crm-wst-detail-avail-legend {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

.crm-wst-detail-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crm-wst-detail-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.crm-wst-detail-sel-bar {
  background: #222222;
  color: #ffffff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.crm-wst-detail-sel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.crm-wst-detail-sel-cart,
.crm-wst-detail-sel-book {
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.crm-wst-detail-sel-cart {
  background: transparent;
  color: #ffffff;
  border: 2px solid #ffffff;
}

.crm-wst-detail-sel-book {
  background: #f5c518;
  color: #000000;
}

.crm-wst-detail-teaser {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 1.5rem;
}

.crm-wst-detail-section {
  margin-bottom: 1.75rem;
}

.crm-wst-detail-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #0e3056;
}

.crm-wst-detail-section-body img {
  max-width: 100%;
  height: auto;
}

.crm-wst-detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crm-wst-detail-list-item {
  padding: 0.35rem 0 0.35rem 1.5rem;
  position: relative;
}

.crm-wst-detail-list-included::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

.crm-wst-detail-list-bring::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  color: #0ea5e9;
  font-weight: 700;
  font-size: 1.2em;
  line-height: 1;
}

.crm-wst-detail-table-wrap {
  overflow-x: auto;
}

.crm-wst-detail-table {
  width: 100%;
  border-collapse: collapse;
}

.crm-wst-detail-table th,
.crm-wst-detail-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.crm-wst-detail-table thead th {
  background: #f9fafb;
  font-weight: 700;
  color: #374151;
}

.crm-wst-detail-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.crm-wst-detail-sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.crm-wst-detail-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  overflow: hidden;
}

.crm-wst-detail-map {
  padding: 0;
}

.crm-wst-detail-map iframe {
  display: block;
}

.crm-wst-detail-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.crm-wst-detail-facts {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.crm-wst-detail-facts li {
  padding: 0.25rem 0;
}

@media (max-width: 900px) {
  .crm-wst-detail-layout {
    grid-template-columns: 1fr;
  }
  .crm-wst-detail-sidebar {
    position: static;
  }
  .crm-wst-detail-avail-grid {
    grid-template-columns: 1fr;
  }
  .crm-wst-detail-avail-btn {
    margin-left: 0;
  }
}

/* ── WST availability calendar (DOM built by default.js) ─────── */
.crm-wst-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.crm-wst-cal-nav {
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0 0.5rem;
  user-select: none;
}

.crm-wst-cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 0.75rem;
}

.crm-wst-cal-table th {
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  padding: 6px 2px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.crm-wst-cal-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 2px;
  text-align: center;
  position: relative;
}

.crm-wst-cal-day {
  cursor: pointer;
}

.crm-wst-cal-day:hover {
  background: #f3f4f6;
}

.crm-wst-cal-out,
.crm-wst-cal-past {
  color: #cccccc;
}

.crm-wst-cal-past {
  cursor: default;
}

.crm-wst-cal-table td[data-selected="true"] {
  outline: 2px solid #f5c518;
  outline-offset: -2px;
}

.crm-wst-avail-badge {
  min-height: 22px;
}

.crm-wst-avail-badge-dot {
  display: inline-block;
  color: #ffffff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}

.crm-wst-cal-check {
  text-align: center;
}

.crm-wst-cal-check-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 30px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.crm-wst-cal-check-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Fare panel (shown after picking a date) */
.crm-wst-fare-panel {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 10px;
}

.crm-wst-fare-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.crm-wst-fare-panel-close {
  cursor: pointer;
  font-size: 1.2rem;
}

.crm-wst-fare-panel-loading,
.crm-wst-fare-panel-empty {
  text-align: center;
  color: #6b7280;
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

.crm-wst-fare-card {
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  cursor: pointer;
}

.crm-wst-fare-card-sold {
  opacity: 0.5;
  cursor: default;
}

.crm-wst-fare-card-selected {
  border-color: #f5c518;
}

.crm-wst-fare-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.crm-wst-fare-card-info {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.crm-wst-fare-check {
  width: 20px;
  height: 20px;
  border: 2px solid #cccccc;
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
  margin-top: 2px;
}

.crm-wst-fare-card-selected .crm-wst-fare-check {
  background: #4caf50;
  border-color: #4caf50;
  position: relative;
}

.crm-wst-fare-card-selected .crm-wst-fare-check::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.crm-wst-fare-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.crm-wst-fare-period {
  color: #6b7280;
  font-size: 0.8rem;
}

.crm-wst-fare-card-right {
  text-align: right;
  white-space: nowrap;
}

.crm-wst-fare-spaces {
  font-weight: 700;
  font-size: 0.85rem;
}

.crm-wst-fare-price {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Selection bar rows */
.crm-wst-sel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.75rem;
}

.crm-wst-sel-fare {
  font-weight: 700;
}

.crm-wst-sel-date {
  font-size: 0.85rem;
  color: #aaaaaa;
}

.crm-wst-sel-qty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crm-wst-sel-step {
  width: 30px;
  height: 30px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.crm-wst-sel-count {
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.crm-wst-sel-remove {
  cursor: pointer;
  font-size: 1.1rem;
  margin-left: 0.35rem;
}

.crm-wst-sel-confirm {
  text-align: center;
  padding: 0.5rem 0;
  color: #4caf50;
  font-weight: 600;
}
