/**
 * JCL Booking Calendar - Frontend Styles
 *
 * Brand tokens from JoRoBee's Culinary Lab design system.
 * All classes prefixed with `jcl-booking-` to avoid conflicts.
 *
 * @package JCL_Booking
 */

/* =================================================================
   Design Tokens (CSS Custom Properties)
   ================================================================= */

:root {
  /* Brand colours */
  --jcl-honey-gold:   #F5C842;
  --jcl-honey-dark:   #E5B732;
  --jcl-leaf-green:   #7CB342;
  --jcl-cream:        #FFF8E1;
  --jcl-cream-dark:   #FFF3CD;
  --jcl-warm-white:   #FFFDF7;
  --jcl-text-dark:    #3E2723;
  --jcl-text-medium:  #5D4037;
  --jcl-text-light:   #8D6E63;
  --jcl-coral-pop:    #E57373;

  /* Typography */
  --jcl-font-display: 'Baloo 2', cursive;
  --jcl-font-body:    'Nunito', sans-serif;

  /* Radii */
  --jcl-radius-sm: 12px;
  --jcl-radius-md: 20px;
}

/* =================================================================
   Widget Wrapper
   ================================================================= */

.jcl-booking-widget {
  /* No extra margin — sits inside CF7 form */
  font-family: var(--jcl-font-body);
  line-height: 1.5;
  color: var(--jcl-text-dark);
}

/* =================================================================
   Calendar
   ================================================================= */

.jcl-booking-calendar {
  background: var(--jcl-warm-white);
  border: 2px solid var(--jcl-cream-dark);
  border-radius: var(--jcl-radius-md);
  padding: 20px;
}

/* ---- Header ---- */

.jcl-booking-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.jcl-booking-month-display {
  font-family: var(--jcl-font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--jcl-text-dark);
  user-select: none;
}

/* ---- Navigation buttons ---- */

.jcl-booking-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--jcl-cream-dark);
  border-radius: 50%;
  background: #fff;
  color: var(--jcl-text-dark);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  flex-shrink: 0;
}

.jcl-booking-nav-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.jcl-booking-nav-btn:hover:not(:disabled) {
  border-color: var(--jcl-honey-gold);
  background: var(--jcl-cream);
}

.jcl-booking-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Day labels ---- */

.jcl-booking-day-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.jcl-booking-day-label {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--jcl-text-light);
  text-align: center;
  padding: 4px 0;
  user-select: none;
}

/* ---- Days grid ---- */

.jcl-booking-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* ---- Day cell (empty placeholder) ---- */

.jcl-booking-day-empty {
  display: block;
}

/* ---- Day cell (button) ---- */

.jcl-booking-day {
  /* Button reset */
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid transparent;
  background: none;
  margin: 0;

  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border-radius: var(--jcl-radius-sm);

  /* Typography */
  font-family: var(--jcl-font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--jcl-text-dark);

  /* Interaction */
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.jcl-booking-day:hover:not(.disabled) {
  background: var(--jcl-cream);
}

/* Disabled state */
.jcl-booking-day.disabled {
  color: var(--jcl-cream-dark);
  cursor: not-allowed;
}

.jcl-booking-day.disabled:hover {
  background: none;
}

/* Today indicator */
.jcl-booking-day.today {
  border-color: var(--jcl-honey-gold);
}

/* Selected state */
.jcl-booking-day.selected {
  background: var(--jcl-honey-gold);
  color: var(--jcl-text-dark);
  font-weight: 800;
  border-color: var(--jcl-honey-gold);
}

/* =================================================================
   Time Slots Section
   ================================================================= */

.jcl-booking-slots-section {
  margin-top: 20px;
}

/* ---- Slots grid ---- */

.jcl-booking-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* ---- Time slot button ---- */

.jcl-booking-slot {
  /* Button reset */
  appearance: none;
  -webkit-appearance: none;
  margin: 0;

  /* Layout */
  padding: 14px;
  border: 2px solid var(--jcl-cream-dark);
  border-radius: var(--jcl-radius-sm);
  text-align: center;
  background: #fff;

  /* Typography */
  font-family: var(--jcl-font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--jcl-text-medium);

  /* Interaction */
  cursor: pointer;
  transition: all 0.2s ease;
}

.jcl-booking-slot:hover:not(:disabled) {
  border-color: var(--jcl-honey-gold);
  background: var(--jcl-cream);
}

/* Selected state */
.jcl-booking-slot.selected {
  border-color: var(--jcl-honey-gold);
  background: var(--jcl-honey-gold);
  color: var(--jcl-text-dark);
  font-weight: 700;
}

/* Unavailable state */
.jcl-booking-slot.unavailable {
  color: var(--jcl-cream-dark);
  cursor: not-allowed;
  text-decoration: line-through;
}

.jcl-booking-slot.unavailable:hover {
  border-color: var(--jcl-cream-dark);
  background: #fff;
}

/* =================================================================
   Messages
   ================================================================= */

.jcl-booking-slots-message {
  text-align: center;
}

.jcl-booking-message {
  display: inline-block;
  padding: 20px;
  color: var(--jcl-text-light);
  font-style: italic;
  font-size: 0.9rem;
}

/* Loading state — subtle pulse */
.jcl-booking-loading {
  animation: jcl-pulse 1.5s ease-in-out infinite;
}

@keyframes jcl-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Error state */
.jcl-booking-error {
  color: var(--jcl-coral-pop);
  font-weight: 600;
  font-style: normal;
}

/* =================================================================
   Validation Message
   ================================================================= */

.jcl-booking-validation {
  display: none;
  color: var(--jcl-coral-pop);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

.jcl-booking-widget.has-error .jcl-booking-validation {
  display: block;
}

/* =================================================================
   Responsive
   ================================================================= */

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

@media (max-width: 480px) {
  .jcl-booking-slots {
    grid-template-columns: repeat(2, 1fr);
  }

  .jcl-booking-day {
    padding: 8px 0;
    font-size: 0.85rem;
  }

  .jcl-booking-slot {
    padding: 12px 8px;
    font-size: 0.85rem;
  }

  .jcl-booking-calendar {
    padding: 16px;
  }
}
