/* MK Booking – Public Styles
 * Uses CSS custom properties set inline by PHP from backend settings.
 * Inherits from Astra theme where possible.
 */

:root {
  --mk-primary:   #d4a843;
  --mk-secondary: #333333;
  --mk-button:    #d4a843;
  --mk-radius:    6px;
  --mk-text:      #333;
  --mk-bg:        #fff;
  --mk-border:    #e0e0e0;
}

/* ============================================================
   Container
   ============================================================ */
.mk-booking-container {
  position: relative;
  font-family: inherit;
  color: var(--mk-text);
  line-height: 1.5;
}

/* ============================================================
   Category filter buttons
   ============================================================ */
.mk-category-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.mk-filter-label { font-weight: 600; font-size: 14px; }
.mk-cat-btn {
  padding: 6px 16px;
  border: 2px solid var(--mk-primary);
  border-radius: var(--mk-radius);
  background: transparent;
  color: var(--mk-primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s, color .2s;
}
.mk-cat-btn:hover,
.mk-cat-btn.active {
  background: var(--mk-primary);
  color: #fff;
}

/* "No courses available" message (shown instead of an empty calendar) */
.mk-booking-container .mk-no-events {
  background: var(--mk-bg);
  border: 1px dashed var(--mk-border);
  border-radius: var(--mk-radius);
  padding: 32px 24px;
  text-align: center;
  color: #666;
  font-size: 15px;
}

/* ============================================================
   Calendar wrapper
   ============================================================ */
.mk-calendar-wrapper {
  background: var(--mk-bg);
  border: 1px solid var(--mk-border);
  border-radius: var(--mk-radius);
  overflow: hidden;
  padding: 4px;
}

/* FullCalendar overrides – minimal theme integration */
.mk-booking-container .fc-toolbar-title { font-size: 1.2em; color: var(--mk-secondary); }
.mk-booking-container .fc-button-primary { background: var(--mk-primary) !important; border-color: var(--mk-primary) !important; border-radius: var(--mk-radius) !important; }
.mk-booking-container .fc-button-primary:disabled { opacity: .6; }
.mk-booking-container .fc-button-primary:not(:disabled):hover { filter: brightness(.9); }
.mk-booking-container .fc-event { border-radius: 4px; font-size: 12px; cursor: pointer; }
.mk-booking-container .fc-day-today { background-color: rgba(212,168,67,.08) !important; }
/* Block events: auto-size to content, show end time, wrap title.
   min-width:0 stops the (non-wrapping) min-content of the children from
   pushing the event wider than its day cell – otherwise it bleeds into the
   next day on narrow screens (e.g. iPhone portrait). */
.mk-booking-container .fc-daygrid-event { min-width: 0; max-width: 100%; }
.mk-booking-container .fc-daygrid-block-event .fc-event-main { padding: 3px 5px; overflow: hidden; min-width: 0; }
.mk-booking-container .fc-daygrid-block-event .fc-event-main-frame {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}
.mk-booking-container .fc-daygrid-event .fc-event-time {
  color: rgba(255,255,255,.95);
  font-size: 11px;
  font-weight: 600;
  white-space: normal;
  flex-shrink: 1;
}
.mk-booking-container .fc-daygrid-event .fc-event-title-container { width: 100%; min-width: 0; }
.mk-booking-container .fc-daygrid-event .fc-event-title {
  white-space: normal;
  line-height: 1.3;
  color: #fff;
  font-size: 11px;
  word-break: break-word;
}
/* Allow the event harness to grow vertically with its content, but never
   wider than the day cell. */
.mk-booking-container .fc-daygrid-event-harness { overflow: visible; max-width: 100%; }
.mk-booking-container .fc-daygrid-day-events { overflow: visible; }

/* Custom event content (course title + availability badge) */
.mk-booking-container .mk-evt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 2px 4px; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.mk-booking-container .mk-evt-time { color: rgba(255,255,255,.95); font-size: 11px; font-weight: 600; white-space: normal; max-width: 100%; }
.mk-booking-container .mk-evt-title { color: #fff; font-size: 11px; line-height: 1.25; white-space: normal; word-break: break-word; max-width: 100%; }
.mk-booking-container .mk-evt-badge {
  display: inline-block;
  margin-top: 1px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.mk-booking-container .mk-evt-free { background: #1e9e4a; color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset; }
.mk-booking-container .mk-evt-full { background: #d63638; color: #fff; }

/* ============================================================
   Course detail panel (slide-in from bottom / sidebar)
   ============================================================ */
.mk-course-panel {
  background: var(--mk-bg);
  border: 1px solid var(--mk-border);
  border-radius: var(--mk-radius);
  margin-top: 20px;
  position: relative;
}
.mk-course-panel-inner { padding: 24px; }
.mk-panel-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: #888;
}
.mk-panel-close:hover { color: #333; }
.mk-course-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mk-course-title { margin: 0; font-size: 20px; color: var(--mk-secondary); }
.mk-course-category-badge {
  padding: 3px 10px; border-radius: 20px;
  background: var(--mk-primary); color: #fff;
  font-size: 12px; font-weight: 700;
}
.mk-course-meta { display: flex; gap: 20px; margin-bottom: 16px; font-size: 14px; }
.mk-course-price { color: #555; }
.mk-badge-green { display: inline-block; background: #d4edda; color: #155724; border-radius: 4px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.mk-badge-red   { display: inline-block; background: #f8d7da; color: #721c24; border-radius: 4px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.mk-course-description { margin-bottom: 16px; font-size: 15px; }
.mk-course-sessions h3 { font-size: 15px; margin-bottom: 8px; }
.mk-sessions-list { list-style: none; padding: 0; margin: 0 0 16px; max-height: 240px; overflow-y: auto; }
.mk-sessions-list li { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.mk-sessions-list li:last-child { border-bottom: none; }
.mk-session-cancelled { text-decoration: line-through; color: #999; }
.mk-session-past { color: #bbb; }
.mk-mid-quarter-note { color: #856404; background: #fff3cd; border-radius: 4px; padding: 6px 10px !important; font-size: 13px; }
.mk-course-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.mk-btn {
  display: inline-block;
  padding: 10px 22px;
  border: none;
  border-radius: var(--mk-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: filter .2s, background .2s;
  text-decoration: none;
}
.mk-btn:hover { filter: brightness(.92); }
.mk-btn-primary { background: var(--mk-button); color: #fff; }
.mk-btn-secondary { background: var(--mk-secondary); color: #fff; }
.mk-btn-outline { background: transparent; border: 2px solid var(--mk-primary); color: var(--mk-primary); }
.mk-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================
   Booking Modal
   ============================================================ */
.mk-booking-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}
.mk-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.mk-modal-inner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--mk-bg);
  border-radius: var(--mk-radius);
  padding: 32px;
  width: min(520px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.mk-modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  font-size: 24px; line-height: 1;
  cursor: pointer; color: #888;
}
.mk-modal-close:hover { color: #333; }
.mk-modal-title { font-size: 20px; margin: 0 0 16px; color: var(--mk-secondary); }

.mk-booking-summary {
  background: #f9f9f9;
  border-left: 4px solid var(--mk-primary);
  padding: 12px 16px;
  border-radius: 0 var(--mk-radius) var(--mk-radius) 0;
  margin-bottom: 20px;
  font-size: 14px;
}
.mk-booking-summary p { margin: 4px 0; }

/* Form fields */
.mk-field-row { margin-bottom: 16px; }
.mk-field-row label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.mk-field-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--mk-border);
  border-radius: var(--mk-radius);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s;
}
.mk-field-input:focus { outline: none; border-color: var(--mk-primary); }
.mk-req { color: #c00; }
.mk-age-fields { display: flex; gap: 10px; }
.mk-age-fields .mk-field-input { flex: 1 1 0; }

/* Trial session selector */
.mk-trial-session-selector { margin-bottom: 16px; }
.mk-trial-session-selector label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.mk-trial-session-select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--mk-border);
  border-radius: var(--mk-radius);
  font-size: 15px;
}

/* Consent */
.mk-consent-row { margin: 16px 0; }
.mk-consent-label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.mk-consent-label input { margin-top: 3px; flex-shrink: 0; }
.mk-consent-text a { color: var(--mk-primary); }

/* Error */
.mk-form-error {
  background: #f8d7da; color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: var(--mk-radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* Form actions */
.mk-form-actions { margin-top: 20px; }

/* Success */
.mk-booking-success { text-align: center; padding: 20px 0; }
.mk-success-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: #d4edda; color: #155724;
  border-radius: 50%; font-size: 28px;
  margin: 0 auto 16px;
}
.mk-success-title { font-size: 20px; color: var(--mk-secondary); margin-bottom: 8px; }
.mk-success-text { color: #555; margin-bottom: 20px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
  .mk-modal-inner { padding: 20px; }
  .mk-course-actions { flex-direction: column; }
  .mk-course-meta { flex-direction: column; gap: 8px; }

  /* Tighten calendar events so they stay inside the (narrow) day cells
     and never bleed into the following day. */
  .mk-booking-container .fc-daygrid-block-event .fc-event-main { padding: 2px 3px; }
  .mk-booking-container .mk-evt { padding: 1px 2px; gap: 1px; }
  .mk-booking-container .mk-evt-time,
  .mk-booking-container .fc-daygrid-event .fc-event-time { font-size: 10px; }
  .mk-booking-container .mk-evt-title,
  .mk-booking-container .fc-daygrid-event .fc-event-title { font-size: 10px; line-height: 1.2; }
  .mk-booking-container .mk-evt-badge { font-size: 9px; padding: 0 5px; border-radius: 8px; }
}
