/* ---------------------------------------------
   Room Calendars — Combined Styles
   Busy + Requested + Selection highlight + Full Minimum Modal + Mobile UX
   --------------------------------------------- */

/* =============================
   BUSY EVENT STYLING (BOOKED)
   ============================= */

.fc .crc-busy-event {
  border-radius: 6px;
  overflow: hidden;
  border: none !important;
}

.fc .crc-busy-event .fc-event-main {
  color: rgba(255,255,255,0.95);
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.18) 0px,
      rgba(255,255,255,0.18) 6px,
      rgba(255,255,255,0.00) 6px,
      rgba(255,255,255,0.00) 12px
    ),
    linear-gradient(
      rgba(184,191,194,0.85),
      rgba(184,191,194,0.85)
    );
  border-radius: 6px;
}

.fc .crc-busy-event .fc-event-main-frame {
  padding: 2px 6px;
}

/* =============================
   REQUESTED EVENT STYLING
   ============================= */

.fc .crc-selection-event {
  border-radius: 6px !important;
  border: 1px solid rgba(22,55,65,0.45) !important;

  background-color: rgba(22,55,65,0.18) !important;

  --fc-event-bg-color: rgba(22,55,65,0.18) !important;
  --fc-event-border-color: rgba(22,55,65,0.45) !important;
}

.fc .crc-selection-event .fc-event-main {
  background: transparent !important;
  color: rgba(22,55,65,0.95) !important;
}

.fc .crc-selection-event .fc-event-title {
  font-weight: 600 !important;
  font-size: 12px;
}

.fc .crc-selection-event .fc-event-resizer,
.fc .crc-selection-event .fc-event-resizer-start,
.fc .crc-selection-event .fc-event-resizer-end {
  display: block !important;
  opacity: 1 !important;
}

.fc .crc-selection-event .fc-event-resizer-start,
.fc .crc-selection-event .fc-event-resizer-end {
  height: 12px !important;
}

.fc .crc-selection-event .fc-event-resizer-start:before,
.fc .crc-selection-event .fc-event-resizer-end:before {
  content: "";
  position: absolute;
  left: 50%;
  width: 38px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(22,55,65,.68);
}

.fc .crc-selection-event .fc-event-resizer-start:before {
  top: 3px;
}

.fc .crc-selection-event .fc-event-resizer-end:before {
  bottom: 3px;
}

/* =============================
   FULLCALENDAR TOOLBAR ALIGNMENT
   ============================= */

.crc-room-calendar.fc .fc-toolbar {
  align-items: center;
  gap: 10px;
}

.crc-room-calendar.fc .fc-toolbar-chunk {
  display: flex;
  align-items: center;
}

.crc-room-calendar.fc .fc-button-group {
  display: inline-flex;
  align-items: stretch;
}

.crc-room-calendar.fc .fc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  line-height: 1;
}

.crc-room-calendar.fc .fc-button .fc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* =============================
   SELECTION HIGHLIGHT STYLING
   ============================= */

.crc-room-calendar.fc .fc-highlight {
  background: rgba(22,55,65,0.18) !important;
  border-radius: 6px !important;
}

.crc-room-calendar.fc .fc-timegrid-selection {
  border: 1px solid rgba(22,55,65,0.45) !important;
  border-radius: 6px !important;
}

/* Mirror event while dragging */
.crc-room-calendar.fc .fc-event-mirror,
.crc-room-calendar.fc .fc-timegrid-event.fc-event-mirror,
.crc-room-calendar.fc .fc-v-event.fc-event-mirror {
  background: rgba(22,55,65,0.18) !important;
  border: 1px solid rgba(22,55,65,0.45) !important;
  border-radius: 6px !important;

  --fc-event-bg-color: rgba(22,55,65,0.18) !important;
  --fc-event-border-color: rgba(22,55,65,0.45) !important;

  box-shadow: none !important;
}

.crc-room-calendar.fc .fc-event-mirror .fc-event-main {
  background: transparent !important;
  color: rgba(22,55,65,0.95) !important;
}

/* =============================
   LEGEND
   ============================= */

.crc-cal-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

/* =============================
   MINIMUM CONFLICT MODAL (restored)
   ============================= */

.crc-minimum-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
}
.crc-minimum-modal.is-open { display: block; }

.crc-minimum-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.crc-minimum-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 420px);
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 16px 16px 14px;
}

.crc-minimum-modal__title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
}

.crc-minimum-modal__body {
  font-size: 14px;
  line-height: 1.35;
  color: rgba(0,0,0,0.75);
  margin-bottom: 14px;
}

.crc-minimum-modal__actions {
  display: flex;
  justify-content: flex-end;
}

.crc-minimum-modal__btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

/* =============================
   MOBILE IMPROVEMENTS
   ============================= */

@media (max-width:768px) {

  /* Prevent long-press selection/copy menu inside calendar */
  .crc-room-calendar,
  .crc-room-calendar * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Allow form fields to remain selectable */
  input, textarea, select, label {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
  }

  /* Taller slots */
  .fc .fc-timegrid-slot {
    height: 2.6em;
  }

  /* Gutter width */
  .fc .fc-timegrid-axis {
    width: 72px !important;
    min-width: 72px !important;
  }

  /* Time labels cushion */
  .fc .fc-timegrid-slot-label {
    font-size: 1rem;
    text-align: left;
  }

  .fc .fc-timegrid-slot-label-cushion {
    padding-left: 4px;
    padding-right: 8px;
    text-align: left;
  }

  /* Bigger tap targets */
  .fc .fc-v-event {
    min-height: 38px;
  }

  .crc-room-calendar {
    overflow-x: hidden;
  }
}

/* --- CRC Legend (Booked / Available / Today) --- */
.crc-cal-legend{
  display:flex;
  align-items:center;
  gap:18px;
  flex-wrap:wrap;
  margin: 10px 0 10px;
}

.crc-cal-legend__item{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(0,0,0,.70);
}

.crc-cal-legend__swatch{
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display:inline-block;
  border: 1px solid rgba(0,0,0,.18);
  box-sizing: border-box;
}

/* Available: white */
.crc-cal-legend__swatch--free{
  background: #fff;
}

/* Booked: hatched (matches your busy block vibe) */
.crc-cal-legend__swatch--busy{
  background:
    repeating-linear-gradient(
      45deg,
      rgba(22,55,65,.18) 0px,
      rgba(22,55,65,.18) 6px,
      rgba(22,55,65,.06) 6px,
      rgba(22,55,65,.06) 12px
    );
  border-color: rgba(22,55,65,.28);
}

/* Today: match FullCalendar "today" tint (uses FC variable if present) */
.crc-cal-legend__swatch--today{
  background: var(--fc-today-bg-color, rgba(255, 220, 40, 0.15));
  border-color: rgba(0,0,0,.12);
}

/* --- CRC Legend tweak: slightly larger swatches for readability --- */
.crc-cal-legend__swatch{
  width: 14px !important;
  height: 14px !important;
  border-radius: 4px !important;
}

/* --- Booking summary formatting --- */
.crc-booking-summary__title{
  margin: 0 0 6px;
}
.crc-booking-summary__row{
  display:flex;
  gap:8px;
  line-height: 1.25;
  margin: 2px 0;
}
.crc-booking-summary__k{
  min-width: 48px;
  opacity: .75;
}
.crc-booking-summary__v{
  font-weight: 700;
}

/* --- Selection confirmation before opening the booking form --- */
.crc-selection-prompt{
  position: sticky;
  top: var(--crc-selection-prompt-sticky-top, 60px);
  z-index: 20;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin: 18px 0 20px;
  padding: 14px 16px;
  border: 1px solid rgba(22,55,65,.42);
  border-radius: 8px;
  background: #f3f5f5;
  box-shadow: 0 12px 26px rgba(22,55,65,.16);
  animation: crc-selection-prompt-in 420ms ease-out both;
}

.crc-selection-prompt:before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:5px;
  background:#163741;
}

.crc-selection-prompt[hidden]{
  display:none !important;
}

.crc-selection-prompt__text{
  position:relative;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  color: rgba(22,55,65,.95);
}

.crc-selection-prompt__label{
  font-weight: 400;
}

.crc-selection-prompt__value{
  font-weight: 400;
}

.crc-selection-prompt__time{
  display:inline-block;
  margin-left: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #163741;
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  box-shadow: 0 2px 6px rgba(22,55,65,.22);
}

.crc-selection-prompt__actions{
  position:relative;
  display:flex;
  gap:8px;
  flex: 0 0 auto;
}

.crc-selection-prompt__mobile-adjust{
  display:none;
}

.crc-selection-prompt__btn{
  appearance:none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor:pointer;
}

.crc-selection-prompt__btn--secondary{
  border: 1px solid rgba(22,55,65,.36);
  background: #fff;
  color: rgba(22,55,65,.95);
}

.crc-selection-prompt__btn--primary{
  border: 1px solid rgba(22,55,65,1);
  background: #163741;
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,55,65,.24);
}

@keyframes crc-selection-prompt-in {
  0% {
    opacity: 0;
    transform: translateY(-6px);
    box-shadow: 0 0 0 4px rgba(22,55,65,.22), 0 12px 26px rgba(22,55,65,.12);
  }
  70% {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 0 0 4px rgba(22,55,65,.10), 0 12px 26px rgba(22,55,65,.16);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 12px 26px rgba(22,55,65,.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .crc-selection-prompt{
    animation:none;
  }
}

@media (max-width:768px) {
  .crc-selection-prompt{
    top: var(--crc-selection-prompt-sticky-top, 43px);
    align-items:stretch;
    flex-direction:column;
    gap:10px;
    margin: 16px 0 20px;
    padding: 14px 14px 16px;
  }

  .crc-selection-prompt__mobile-adjust{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:8px;
  }

  .crc-selection-prompt__time-field{
    position:relative;
    display:block;
    min-width:0;
  }

  .crc-selection-prompt__adjust-label{
    position:absolute;
    left:10px;
    top:50%;
    z-index:1;
    transform:translateY(-50%);
    font-size: 11px;
    font-weight: 800;
    color: rgba(22,55,65,.82);
    pointer-events:none;
  }

  .crc-selection-prompt__select{
    appearance:none;
    min-width: 0;
    width:100%;
    height: 34px;
    min-height: 34px;
    padding: 2px 26px 2px 48px;
    border: 1px solid rgba(22,55,65,.22);
    border-radius: 8px;
    background: #fff;
    color: rgba(22,55,65,.95);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
  }

  .crc-selection-prompt__select{
    background-image:
      linear-gradient(45deg, transparent 50%, rgba(22,55,65,.75) 50%),
      linear-gradient(135deg, rgba(22,55,65,.75) 50%, transparent 50%);
    background-position:
      calc(100% - 15px) 50%,
      calc(100% - 10px) 50%;
    background-size:
      5px 5px,
      5px 5px;
    background-repeat:no-repeat;
  }

  .crc-selection-prompt__actions{
    width:100%;
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crc-selection-prompt__btn{
    width:100%;
    min-height: 40px;
    padding: 8px 8px;
  }

  .crc-room-calendar.fc .fc-toolbar {
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
  }

  .crc-room-calendar.fc .fc-toolbar-title {
    line-height: 1.15;
  }

  .crc-room-calendar.fc .fc-button {
    min-height: 40px;
    padding-top: 0.55em;
    padding-bottom: 0.55em;
  }

  .fc .crc-selection-event .fc-event-resizer-start,
  .fc .crc-selection-event .fc-event-resizer-end {
    height: 18px !important;
  }

  .fc .crc-selection-event .fc-event-resizer-start:before,
  .fc .crc-selection-event .fc-event-resizer-end:before {
    width: 52px;
    height: 5px;
  }
}
