/* --- site.css --- */

/* 1) Base card on all viewports */
.page-content {
  margin: 2rem auto;
  padding: 2rem;
  max-width: 900px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Hide x-cloak elements until Alpine initializes */
[x-cloak] { display: none !important; }

/* 2) Tablet tweak */
@media (max-width: 992px) {
  .page-content {
    margin: 1.5rem auto;
    padding: 1.5rem;
  }
}

/* 3) Mobile tweak */
@media (max-width: 576px) {
  .page-content {
    margin: 1rem;
    padding: 1rem;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  }
}

/* Help panel */
.help-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
}

.help-panel-backdrop.help-panel-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

.help-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: #ffffff;
  box-shadow: -6px 0 18px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 80;
}

.help-panel.help-panel--open {
  transform: translateX(0);
}

.help-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.help-panel__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.help-panel__subtitle {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #4b5563;
  max-width: 20rem;
}

.help-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #6b7280;
  padding: 0.25rem;
}

.help-panel__close:hover,
.help-panel__close:focus {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  outline: none;
}

.help-panel__body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.help-panel__quickstart {
  margin-bottom: 1.25rem;
}

.help-panel__quickstart a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: #1d4ed8;
}

.help-panel__quickstart a::before {
  content: '\2139';
  font-size: 0.95rem;
}

.help-panel__loading,
.help-panel__empty {
  font-size: 0.9rem;
  color: #4b5563;
}

.help-panel__article-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
}

.help-panel__article-content {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1f2937;
}

.help-panel__article-content h1,
.help-panel__article-content h2,
.help-panel__article-content h3 {
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
  color: #0f172a;
}

.help-panel__article-content h1:first-child,
.help-panel__article-content h2:first-child,
.help-panel__article-content h3:first-child {
  margin-top: 0;
}

.help-panel__article-content p + p,
.help-panel__article-content p + ul,
.help-panel__article-content ul + p,
.help-panel__article-content ol + p {
  margin-top: 0.9rem;
}

.help-panel__article-content ul,
.help-panel__article-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.9rem;
}

.help-panel__article-content ul li {
  list-style: disc;
}

.help-panel__article-content ol li {
  list-style: decimal;
}

.help-panel__article-content a {
  color: #1d4ed8;
  text-decoration: underline;
}

.help-panel__article-content p + p {
  margin-top: 0.75rem;
}

.help-article-body h1,
.help-article-body h2,
.help-article-body h3 {
  font-weight: 600;
  margin-top: 1.5rem;
}

.help-article-body h1:first-child,
.help-article-body h2:first-child,
.help-article-body h3:first-child {
  margin-top: 0;
}

.help-article-body p + p,
.help-article-body p + ul,
.help-article-body ul + p,
.help-article-body ol + p {
  margin-top: 0.9rem;
}

.help-panel__meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.help-panel__actions {
  margin-top: 1rem;
}

.help-panel__page-link {
  margin-top: 0.75rem;
}

.help-panel__page-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #2563eb;
}

/* Cross-site switch button (SimpleMed ↔ SimpleMed+) */
.sm-side-switch {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  border-radius: 0 999px 999px 0;
  background: #03ccbd;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
  z-index: 60;
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.sm-side-switch:hover {
  background: #0b858a;
  transform: translateY(-50%) translateX(2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.22);
}

.sm-side-switch:focus-visible {
  outline: 3px solid rgba(3, 204, 189, 0.55);
  outline-offset: 3px;
}

@media (max-width: 576px) {
  .sm-side-switch {
    width: 42px;
    height: 62px;
    font-size: 14px;
  }
}

.help-panel__primary-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #2563eb;
  font-weight: 500;
}

.help-panel__primary-link:hover,
.help-panel__secondary-link:hover {
  text-decoration: underline;
}

.help-panel__related {
  margin-top: 2rem;
}

.help-panel__related-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.help-panel__related-list {
  display: grid;
  gap: 0.5rem;
}

.help-panel__related-list button {
  width: 100%;
  text-align: left;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: #1f2937;
}

.help-panel__related-list button:hover,
.help-panel__related-list button:focus {
  border-color: #93c5fd;
  outline: none;
}

.help-panel__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.help-panel__footer-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.help-panel__secondary-link {
  font-size: 0.9rem;
  color: #1f2937;
  font-weight: 500;
}

/* Inline tip bubbles */
.help-tip-container {
  position: relative;
  display: inline-block;
}

.help-tip-trigger {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 9999px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: transform 0.15s ease, background 0.15s ease;
}

.help-tip-trigger:hover,
.help-tip-trigger:focus {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(37, 99, 235, 0.6);
  transform: scale(1.05);
  outline: none;
}

.help-tip-popover {
  position: absolute;
  max-width: min(20rem, calc(100vw - 2rem));
  background: #111827;
  color: #f9fafb;
  padding: 0.75rem 0.9rem;
  border-radius: 0.5rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
  z-index: 90;
}

.help-tip-popover h5 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.help-tip-popover p {
  font-size: 0.85rem;
  line-height: 1.45;
}

.help-tip-popover a {
  display: inline-flex;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #bfdbfe;
}

.help-tip-popover a:hover {
  text-decoration: underline;
}

/* Learner explanation rich text */
.explanation-rich-text a {
  color: #03ccbd;
  text-decoration: none;
  font-weight: 600;
}

.explanation-rich-text a:hover,
.explanation-rich-text a:focus {
  color: #0b858a;
  text-decoration: underline;
}

.explanation-rich-text p + p {
  margin-top: 0.85rem;
}

.explanation-rich-text strong {
  font-weight: 700;
  color: #6b7280; /* matches text-gray-500 used in references heading */
}

/* Global page-transition spinner (Founder feedback ID 21) */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(2px);
  z-index: 120;
}

.page-transition-spinner {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  border: 4px solid rgba(15, 23, 42, 0.14);
  border-top-color: rgba(3, 204, 189, 0.9);
  animation: smplus-spin 0.85s linear infinite;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
}

@keyframes smplus-spin {
  to {
    transform: rotate(360deg);
  }
}
