/* WWOOF Bookings Dashboard V2 - presentation layer */
:root {
  --wwoof-green: #08783d;
  --wwoof-green-dark: #075f31;
  --wwoof-ink: #17352d;
  --wwoof-muted: #60716d;
  --wwoof-line: #dfe7e3;
  --wwoof-soft: #f4f8f5;
  --wwoof-orange: #f39a24;
  --wwoof-purple: #8055d9;
  --wwoof-blue: #1687df;
  --wwoof-red: #ed3d4a;
}

.wwoof-booking-dashboard {
  color: var(--wwoof-ink);
  font-family: inherit;
}

/* Top controls */
.wwoof-booking-dashboard .dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin: 0 0 22px;
  padding: 0 0 18px;
  border-bottom: 2px solid var(--wwoof-green);
}
.wwoof-booking-dashboard .filter-controls,
.wwoof-booking-dashboard .view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wwoof-booking-dashboard .status-filter-button,
.wwoof-booking-dashboard .sort-dropdown label .sort-select,
.wwoof-booking-dashboard .view-buttons button {
  min-height: 42px;
  border: 1px solid #d6dfdb;
  border-radius: 9px;
  background: #fff;
  color: var(--wwoof-ink);
  box-shadow: 0 1px 3px rgba(24, 55, 45, .05);
}
.wwoof-booking-dashboard .status-filter-button {
  padding: 9px 14px;
}
.wwoof-booking-dashboard .sort-dropdown label { gap: 8px; }
.wwoof-booking-dashboard .sort-dropdown label .sort-label {
  color: var(--wwoof-ink);
  font-weight: 600;
}
.wwoof-booking-dashboard .sort-dropdown label .sort-select {
  min-width: 225px;
  padding: 9px 12px;
}
.wwoof-booking-dashboard .view-buttons button {
  padding: 9px 17px;
  font-weight: 700;
}
.wwoof-booking-dashboard .view-buttons button.active {
  border-color: var(--wwoof-green);
  background: var(--wwoof-green);
  color: #fff;
}

/* Status legend */
.wwoof-booking-dashboard .calendar-legend {
  margin: 0 0 2px;
  padding: 13px 18px;
  border: 1px solid #dbe3df;
  border-radius: 11px;
  background: #fbfcfb;
  box-shadow: none;
}
.wwoof-booking-dashboard .calendar-legend .legend-items {
  justify-content: flex-start;
  gap: 22px;
}
.wwoof-booking-dashboard .calendar-legend .legend-item {
  gap: 8px;
  color: var(--wwoof-ink);
  font-size: 13px;
}
.wwoof-booking-dashboard .calendar-legend .legend-color {
  width: 13px;
  height: 13px;
  border-radius: 4px;
}

/* Booking list */
.wwoof-booking-dashboard .bookings-list {
  gap: 14px;
}
.wwoof-booking-dashboard .booking-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1.55fr) minmax(210px, 1fr) minmax(180px, .85fr) minmax(180px, .85fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 145px;
  box-sizing: border-box;
  padding: 20px 22px;
  border: 1px solid rgba(30, 70, 57, .10);
  border-left: 4px solid #b9c7c1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(28, 64, 52, .08);
  /* Do not transform booking cards: modal components are rendered inside the card, and a
     transformed ancestor changes the containing block for position:fixed overlays. */
  transition: box-shadow .2s ease;
}
.wwoof-booking-dashboard .booking-card:hover {
  box-shadow: 0 8px 20px rgba(28, 64, 52, .12);
}

/* Status colour becomes the left accent */
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#f39a24"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(243, 154, 36)"]) { border-left-color: var(--wwoof-orange); }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#1687df"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(22, 135, 223)"]) { border-left-color: var(--wwoof-blue); }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#dc3545"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(220, 53, 69)"]) { border-left-color: var(--wwoof-red); }

.wwoof-booking-dashboard .booking-header {
  display: contents;
}
.wwoof-booking-dashboard .booking-header > div:first-child {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  margin: 0;
  color: var(--wwoof-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}
.wwoof-booking-dashboard .booking-header > div:first-child::first-letter {
  color: var(--wwoof-green);
}
.wwoof-booking-dashboard .booking-header .status-badge {
  grid-column: 3;
  grid-row: 1;
  justify-self: start;
  align-self: end;
  min-width: 105px;
  margin: 0 0 4px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .25px;
  box-shadow: none;
}

.wwoof-booking-dashboard .booking-dates {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  padding: 0 22px;
  border-left: 1px solid var(--wwoof-line);
  border-right: 1px solid var(--wwoof-line);
}
.wwoof-booking-dashboard .booking-dates p {
  margin: 0;
  color: var(--wwoof-muted);
  font-size: 13px;
  line-height: 1.5;
}
.wwoof-booking-dashboard .booking-dates p::first-line {
  color: var(--wwoof-muted);
}
.wwoof-booking-dashboard .profile-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--wwoof-green);
  border: 0;
  font-size: 17px;
  font-weight: 700;
}
.wwoof-booking-dashboard .profile-link:hover {
  color: var(--wwoof-green-dark);
  border: 0;
}

/* Add a useful role label without changing the React markup */
.wwoof-booking-dashboard .booking-dates::before {
  display: block;
  margin-bottom: 1px;
  color: var(--wwoof-muted);
  font-size: 12px;
  content: "With";
}
.wwoof-booking-dashboard .booking-dates p::first-letter { color: transparent; }

.wwoof-booking-dashboard .booking-actions {
  grid-column: 4;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding-left: 22px;
}
.wwoof-booking-dashboard .booking-actions .action-button {
  width: 100%;
  min-height: 39px;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--wwoof-green);
  border-radius: 8px;
  background: #fff;
  color: var(--wwoof-green-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15px;
}
.wwoof-booking-dashboard .booking-actions .action-button:hover {
  background: #f2f8f4;
}
.wwoof-booking-dashboard .booking-actions .accept-button {
  background: var(--wwoof-green);
  color: #fff;
}
.wwoof-booking-dashboard .booking-actions .accept-button:hover { background: var(--wwoof-green-dark); }
.wwoof-booking-dashboard .booking-actions .cancel-button {
  background: #fff;
  color: #9d2630;
  border-color: #e3a4aa;
}
.wwoof-booking-dashboard .booking-actions .edit-button {
  background: #fff;
  color: #8a6200;
  border-color: #e5c36b;
}

/* Status badge colours remain driven by React inline styles */
.wwoof-booking-dashboard .status-badge {
  border-radius: 999px;
  padding: 7px 13px;
}

/* Responsive */
@media (max-width: 980px) {
  .wwoof-booking-dashboard .booking-card {
    grid-template-columns: minmax(230px, 1.2fr) minmax(190px, 1fr) minmax(150px, .8fr);
  }
  .wwoof-booking-dashboard .booking-actions { grid-column: 3; }
  .wwoof-booking-dashboard .booking-header .status-badge { grid-column: 3; }
}
@media (max-width: 760px) {
  .wwoof-booking-dashboard .dashboard-header { flex-direction: column; align-items: stretch; }
  .wwoof-booking-dashboard .filter-controls,
  .wwoof-booking-dashboard .view-controls { width: 100%; flex-wrap: wrap; }
  .wwoof-booking-dashboard .sort-dropdown,
  .wwoof-booking-dashboard .sort-dropdown label,
  .wwoof-booking-dashboard .sort-dropdown label .sort-select { width: 100%; box-sizing: border-box; }
  .wwoof-booking-dashboard .booking-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    min-height: 0;
    padding: 18px;
  }
  .wwoof-booking-dashboard .booking-header > div:first-child {
    grid-column: 1;
    grid-row: 1;
    font-size: 18px;
  }
  .wwoof-booking-dashboard .booking-header .status-badge {
    grid-column: 2;
    grid-row: 1;
  }
  .wwoof-booking-dashboard .booking-dates {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--wwoof-line);
    border-right: 0;
    border-bottom: 1px solid var(--wwoof-line);
    border-left: 0;
  }
  .wwoof-booking-dashboard .booking-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 14px 0 0;
  }
  .wwoof-booking-dashboard .booking-actions .action-button { width: auto; flex: 1 1 120px; }
}
@media (max-width: 480px) {
  .wwoof-booking-dashboard .booking-actions { flex-direction: column; }
  .wwoof-booking-dashboard .booking-actions .action-button { width: 100%; }
}

/* V2 rich booking row markup */
.wwoof-booking-dashboard .booking-date-block {
  display: flex;
  align-items: center;
  gap: 13px;
}
.wwoof-booking-dashboard .booking-date-icon { font-size: 25px; line-height: 1; }
.wwoof-booking-dashboard .booking-date-block strong {
  display: block;
  color: var(--wwoof-ink);
  font-size: 19px;
  line-height: 1.3;
}
.wwoof-booking-dashboard .booking-duration {
  display: block;
  margin-top: 3px;
  color: var(--wwoof-muted);
  font-size: 13px;
  font-weight: 500;
}
.wwoof-booking-dashboard .booking-participant {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 22px;
  border-left: 1px solid var(--wwoof-line);
}
.wwoof-booking-dashboard .booking-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(28,64,52,.12);
}
.wwoof-booking-dashboard .booking-participant-info { min-width: 0; }
.wwoof-booking-dashboard .booking-with-label {
  display: block;
  color: var(--wwoof-muted);
  font-size: 12px;
  line-height: 1.1;
}
.wwoof-booking-dashboard .booking-participant .profile-link {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--wwoof-green);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wwoof-booking-dashboard .booking-profile-link {
  display: block;
  margin-top: 2px;
  color: var(--wwoof-green-dark);
  font-size: 12px;
  text-decoration: none;
}
.wwoof-booking-dashboard .booking-profile-link:hover { text-decoration: underline; }
.wwoof-booking-dashboard .booking-meta {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 7px;
  color: var(--wwoof-muted);
  font-size: 12px;
}
.wwoof-booking-dashboard .booking-status-detail {
  grid-column: 3;
  grid-row: 2;
  align-self: start;
  margin-top: 2px;
  color: var(--wwoof-muted);
  font-size: 12px;
}
.wwoof-booking-dashboard .booking-actions { grid-column: 4; }

/* Keep the original action variants looking like the mockup */
.wwoof-booking-dashboard .booking-actions .message-action { order: 10; }

@media (max-width: 980px) {
  .wwoof-booking-dashboard .booking-participant { grid-column: 2; }
  .wwoof-booking-dashboard .booking-meta { grid-column: 1; }
  .wwoof-booking-dashboard .booking-status-detail { grid-column: 3; }
}
@media (max-width: 760px) {
  .wwoof-booking-dashboard .booking-participant { grid-column: 1 / -1; grid-row: 2; padding: 14px 0; border-left: 0; border-top: 1px solid var(--wwoof-line); }
  .wwoof-booking-dashboard .booking-meta { grid-column: 1 / -1; grid-row: 3; }
  .wwoof-booking-dashboard .booking-status-detail { grid-column: 1 / -1; grid-row: 4; margin-top: 8px; }
  .wwoof-booking-dashboard .booking-actions { grid-column: 1 / -1; grid-row: 5; }
}

/* Final row alignment corrections */
.wwoof-booking-dashboard .booking-header > div:first-child,
.wwoof-booking-dashboard .booking-date-block {
  grid-column: 1;
  grid-row: 1;
}
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#F59E0B"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(245, 158, 11)"]) { border-left-color: #F59E0B; }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#3B82F6"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(59, 130, 246)"]) { border-left-color: #3B82F6; }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#EF4444"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(239, 68, 68)"]) { border-left-color: #EF4444; }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#10B981"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(16, 185, 129)"]) { border-left-color: #10B981; }
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="#6B7280"]),
.wwoof-booking-dashboard .booking-card:has(.status-badge[style*="rgb(107, 114, 128)"]) { border-left-color: #6B7280; }

/* Review actions: keep labels inside the action column even with longer text. */
.wwoof-booking-dashboard .booking-actions .review-buttons {
  width: 100%;
  min-width: 0;
}
.wwoof-booking-dashboard .booking-actions .review-buttons .review-button {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* V4 polish: modal comfort, stronger card separation, clearer duration, mobile action sizing */
.wwoof-booking-dashboard .booking-card {
  box-shadow: 0 6px 20px rgba(28, 64, 52, .13);
}
.wwoof-booking-dashboard .booking-card:hover {
  box-shadow: 0 9px 26px rgba(28, 64, 52, .17);
}
.wwoof-booking-dashboard .booking-duration {
  color: var(--wwoof-ink);
  font-size: 14px;
  font-weight: 650;
}

/* Review / generic modal used by the React booking interface. */
.wwoof-booking-dashboard .modal-content {
  box-sizing: border-box;
  padding: 18px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(20, 50, 40, .20);
}
.wwoof-booking-dashboard .modal-content .modal-header,
.wwoof-booking-dashboard .modal-content .modal-body {
  box-sizing: border-box;
}
.wwoof-booking-dashboard .modal-content .modal-body {
  padding: 0;
}

/* The review buttons should never force the action column wider than its card. */
.wwoof-booking-dashboard .booking-actions .review-button {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 760px) {
  /* Mobile cards need compact controls, not giant touch panels. */
  .wwoof-booking-dashboard .booking-actions {
    gap: 8px;
    padding-top: 12px;
  }
  .wwoof-booking-dashboard .booking-actions .action-button,
  .wwoof-booking-dashboard .booking-actions .review-button {
    width: 100%;
    min-height: 46px;
    height: auto;
    padding: 10px 14px;
    line-height: 1.2;
    font-size: 13px;
  }
  .wwoof-booking-dashboard .booking-actions .review-buttons {
    gap: 8px;
    margin-top: 0;
  }
  .wwoof-booking-dashboard .booking-card {
    box-shadow: 0 6px 18px rgba(28, 64, 52, .14);
  }
}

@media (max-width: 480px) {
  .wwoof-booking-dashboard .booking-actions .action-button,
  .wwoof-booking-dashboard .booking-actions .review-button {
    min-height: 44px;
    padding: 9px 12px;
  }
}

/* V5 mobile fix: the base flex: 1 1 120px rule makes column buttons
   grow vertically and creates the oversized mobile action panels. */
@media (max-width: 760px) {
  .wwoof-booking-dashboard .booking-actions .action-button,
  .wwoof-booking-dashboard .booking-actions .review-button {
    flex: 0 0 auto;
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 10px 14px;
    line-height: 1.2;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .wwoof-booking-dashboard .booking-actions .action-button,
  .wwoof-booking-dashboard .booking-actions .review-button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 12px;
  }
}
