/*
 * TIB Booking — Enhanced Calendar
 * Drop-in CSS additions for trauma-institute.com
 *
 * Deploy to: wp-content/themes/trauma-institute/assets/css/tib-enhanced.css
 * Enqueue in functions.php after the existing tib-booking style.
 *
 * These rules ADD to the existing TIB styles — they do not replace them.
 * Only the calendar grid, clinician switcher, and slot grid receive new rules.
 */

/* ── Calendar grid — drag/swipe interaction ── */
.tib-cal-cells {
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* Smooth month transition */
  transition: opacity .18s ease, transform .18s ease;
  will-change: transform, opacity;
}

.tib-cal-cells.ti-dragging {
  cursor: grabbing;
}

/* Slide-out animation class (added by JS before swapping month) */
.tib-cal-cells.ti-slide-out-left {
  opacity: 0;
  transform: translateX(-28px);
  pointer-events: none;
}

.tib-cal-cells.ti-slide-out-right {
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
}

/* Slide-in animation class (added immediately after month renders) */
.tib-cal-cells.ti-slide-in {
  opacity: 0;
  transform: translateX(0);
  animation: tib-slide-in .22s ease forwards;
}

@keyframes tib-slide-in {
  from { opacity: 0; transform: translateX(var(--ti-slide-from, 24px)); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Drag in-progress: visual rubber-band on calendar header */
.tib-calendar-wrap.ti-drag-active .tib-cal-month-label {
  color: var(--tib-gold);
  transition: color .1s ease;
}

/* ── Velocity indicator (appears briefly after a drag) ── */
.ti-month-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  color: var(--tib-gold);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 10;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.ti-month-flash.ti-flash-show {
  opacity: .35;
}

/* ── Swipe hint strip ── */
.ti-swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'Jost', 'Helvetica Neue', sans-serif;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(90, 112, 112, .55);
  opacity: 1;
  transition: opacity .4s ease;
}

.ti-swipe-hint.ti-hint-fade {
  opacity: 0;
}

.ti-swipe-arrows {
  display: flex;
  gap: 2px;
  font-size: 13px;
  opacity: .5;
}

/* ── Month navigation button — hit area expansion ── */
.tib-cal-prev,
.tib-cal-next {
  position: relative;
}
.tib-cal-prev::before,
.tib-cal-next::before {
  content: '';
  position: absolute;
  inset: -8px;
}

/* ── Month label — animated on navigation ── */
.tib-cal-month-label {
  transition: opacity .15s ease;
  min-width: 140px;
  text-align: center;
}

.tib-cal-month-label.ti-fading {
  opacity: 0;
}

/* ── Calendar cell — enhanced hover / active states ── */
.tib-cal-cell--available {
  position: relative;
  overflow: hidden;
}

.tib-cal-cell--available::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(200,160,48,.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .2s ease;
  border-radius: inherit;
  pointer-events: none;
}

.tib-cal-cell--available:hover::after {
  opacity: 1;
}

/* Selected ripple */
.tib-cal-cell--selected {
  position: relative;
  overflow: hidden;
}

.tib-cal-cell--selected::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  animation: ti-ripple .35s ease-out forwards;
  pointer-events: none;
}

@keyframes ti-ripple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ── Today dot ── */
.tib-cal-cell--today {
  position: relative;
}

.tib-cal-cell--today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--tib-gold);
  pointer-events: none;
}

/* ── Slot button — staggered entrance animation ── */
.tib-slot-btn {
  opacity: 0;
  transform: translateY(6px);
  animation: ti-slot-in .22s ease forwards;
}

.tib-slot-btn:nth-child(1)  { animation-delay: .03s }
.tib-slot-btn:nth-child(2)  { animation-delay: .06s }
.tib-slot-btn:nth-child(3)  { animation-delay: .09s }
.tib-slot-btn:nth-child(4)  { animation-delay: .12s }
.tib-slot-btn:nth-child(5)  { animation-delay: .15s }
.tib-slot-btn:nth-child(6)  { animation-delay: .18s }
.tib-slot-btn:nth-child(7)  { animation-delay: .21s }
.tib-slot-btn:nth-child(8)  { animation-delay: .24s }

@keyframes ti-slot-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Form panel — slide-down reveal ── */
#tib-form-panel {
  animation: ti-form-reveal .25s ease forwards;
  transform-origin: top;
}

@keyframes ti-form-reveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Date label in slots pane — animated update ── */
.ti-date-label-update {
  animation: ti-label-flash .3s ease;
}

@keyframes ti-label-flash {
  0%   { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Loading shimmer — refined version ── */
.tib-cal-cell--loading {
  background: linear-gradient(90deg, rgba(26,45,45,.3) 25%, rgba(26,45,45,.5) 50%, rgba(26,45,45,.3) 75%);
  background-size: 200% 100%;
  animation: ti-shimmer 1.4s ease infinite;
}

@keyframes ti-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Keyboard focus ring — gold instead of browser default ── */
.tib-cal-cell--available:focus,
.tib-slot-btn:focus {
  outline: 2px solid rgba(200, 160, 48, .7);
  outline-offset: 2px;
}

/* ── Clinician switcher (if multiple clinicians exist) ── */
.ti-clinician-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ti-clinician-tabs::-webkit-scrollbar { display: none; }

.tib-clinician-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(26,45,45,.35);
  border: 1px solid var(--tib-border, rgba(200,160,48,.25));
  color: var(--tib-text-muted, #a8b8b8);
  font-family: 'Jost', 'Helvetica Neue', sans-serif;
  font-size: 12px;
  padding: 7px 14px 7px 10px;
  border-radius: var(--tib-r, 6px);
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}

.tib-clinician-btn:hover {
  border-color: rgba(200,160,48,.4);
  color: var(--tib-text, #f0ede8);
}

.tib-clinician-btn.tib-clinician-btn--active {
  background: rgba(200,160,48,.12);
  border-color: var(--tib-gold, #c8a030);
  color: var(--tib-gold, #c8a030);
}

.ti-clinician-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26,45,45,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--tib-gold, #c8a030);
  flex-shrink: 0;
  border: 1px solid rgba(200,160,48,.2);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .tib-booking-grid {
    grid-template-columns: 1fr !important;
  }

  .tib-left {
    border-right: none !important;
    border-bottom: 1px solid rgba(122,160,160,.15);
  }
}
