/**
 * RFA Course Modal — styles
 * Brand tokens: primary red #950032, navy #045184, cream #FAFAF8
 * Font: Poppins
 */

#rfa-course-modal-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

#rfa-course-modal-root.rfacm-open {
  pointer-events: auto;
}

/* ── Backdrop ────────────────────────────────────────────── */
.rfacm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 18, 0.55);
  opacity: 0;
  transition: opacity 0.28s ease;
}

#rfa-course-modal-root.rfacm-open .rfacm-backdrop {
  opacity: 1;
}

/* ── Sheet — mobile-first: bottom sheet ─────────────────────── */
.rfacm-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  background: #FAFAF8;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(20, 16, 18, 0.18);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#rfa-course-modal-root.rfacm-open .rfacm-sheet {
  transform: translateY(0);
}

.rfacm-handle {
  width: 100%;
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  cursor: grab;
}

.rfacm-handle::before {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: rgba(20, 16, 18, 0.18);
}

.rfacm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 16, 18, 0.06);
  color: #141012;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: none; /* shown on desktop; mobile relies on swipe + handle */
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}



.rfacm-close:hover {
  background: rgba(20, 16, 18, 0.12);
}

.rfacm-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 28px;
}

/* ── Content ─────────────────────────────────────────────── */
.rfacm-content {
  animation: rfacm-fade-in 0.24s ease;
}

@keyframes rfacm-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.rfacm-eyebrow {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #950032;
  margin-bottom: 6px;
}

.rfacm-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #141012;
  margin: 0 0 10px;
}

.rfacm-desc {
  font-size: 15px;
  line-height: 1.55;
  color: #4a4448;
  margin: 0 0 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── At-a-glance fact cards ──────────────────────────────── */
.rfacm-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.rfacm-fact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  height: 56px;
  background: #fff;
  border: 1px solid rgba(20, 16, 18, 0.08);
  border-radius: 12px;
  padding: 0 12px;
  overflow: hidden;
}

.rfacm-fact-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #045184;
  opacity: 0.7;
  white-space: nowrap;
}

.rfacm-fact-value {
  font-size: 14px;
  font-weight: 600;
  color: #141012;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfacm-fact-price {
  background: #fff5f7;
  border-color: rgba(149, 0, 50, 0.18);
}

.rfacm-fact-price .rfacm-fact-label {
  color: #950032;
  opacity: 0.8;
}

.rfacm-fact-price .rfacm-fact-value {
  color: #950032;
}

@media (max-width: 380px) {
  .rfacm-facts {
    grid-template-columns: 1fr 1fr;
  }
  .rfacm-fact-price {
    grid-column: span 2;
  }
}

/* ── Availability — the signature moment ────────────────────── */
.rfacm-availability {
  margin-bottom: 18px;
  min-height: 24px;
}

.rfacm-avail-pulse-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  color: #4a4448;
}

.rfacm-avail-open .rfacm-avail-pulse-row,
.rfacm-avail-open {
  color: #0d6b3a;
}

.rfacm-avail-closed {
  color: #6b6266;
}

.rfacm-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.rfacm-pulse-loading {
  background: #c9c2c5;
  animation: rfacm-pulse-fade 1.1s ease-in-out infinite;
}

.rfacm-pulse-live {
  background: #1a9b53;
}

.rfacm-pulse-live::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid #1a9b53;
  opacity: 0.6;
  animation: rfacm-pulse-ring 1.8s ease-out infinite;
}

.rfacm-pulse-closed {
  background: #b8b0b3;
}

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

@keyframes rfacm-pulse-ring {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rfacm-pulse-loading,
  .rfacm-pulse-live::after {
    animation: none;
  }
}

/* ── Actions ─────────────────────────────────────────────── */
.rfacm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.rfacm-btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
  width: 100%;
}

.rfacm-btn:active {
  transform: scale(0.98);
}

.rfacm-btn-primary {
  background: #950032;
  color: #fff;
}

.rfacm-btn-primary:hover {
  opacity: 0.92;
}

.rfacm-btn-secondary {
  background: rgba(20, 16, 18, 0.06);
  color: #141012;
}

.rfacm-fulllink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #045184;
  text-decoration: none;
  padding: 6px 0;
}

.rfacm-fulllink:hover {
  text-decoration: underline;
}

/* ── Loading skeleton ────────────────────────────────────── */
.rfacm-skeleton {
  padding-top: 4px;
}

.rfacm-skel-line {
  background: rgba(20, 16, 18, 0.08);
  border-radius: 6px;
  animation: rfacm-skel-shimmer 1.3s ease-in-out infinite;
}

.rfacm-skel-eyebrow { width: 80px; height: 12px; margin-bottom: 12px; }
.rfacm-skel-title { width: 70%; height: 26px; margin-bottom: 14px; }
.rfacm-skel-text { width: 100%; height: 14px; margin-bottom: 8px; }
.rfacm-skel-text.short { width: 60%; }

.rfacm-skel-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}

.rfacm-skel-pill {
  height: 56px;
  border-radius: 12px;
  background: rgba(20, 16, 18, 0.06);
  animation: rfacm-skel-shimmer 1.3s ease-in-out infinite;
}

.rfacm-skel-cta {
  width: 100%;
  height: 50px;
  border-radius: 12px;
  background: rgba(20, 16, 18, 0.08);
  margin-top: 20px;
  animation: rfacm-skel-shimmer 1.3s ease-in-out infinite;
}

@keyframes rfacm-skel-shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Error state ─────────────────────────────────────────── */
.rfacm-error {
  text-align: center;
  padding: 32px 0;
}

.rfacm-error p {
  font-size: 15px;
  color: #4a4448;
  margin-bottom: 20px;
}

.rfacm-error .rfacm-btn {
  width: auto;
  padding: 12px 28px;
}

/* ── Desktop: centered card instead of bottom sheet ─────────── */
@media (min-width: 720px) {
  .rfacm-sheet {
    left: 50%;
    bottom: auto;
    top: 50%;
    width: 480px;
    max-height: 82vh;
    border-radius: 20px;
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  }

  #rfa-course-modal-root.rfacm-open .rfacm-sheet {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .rfacm-handle {
    display: none;
  }

  .rfacm-close {
    display: flex;
  }

  .rfacm-body {
    padding: 28px 32px 28px;
  }

  .rfacm-actions {
    flex-direction: row;
  }
}
