/* Medication Guide Page Overrides
   Author: Cascade
   Date: 2025-08-09
   Purpose: Elevate design/UX, improve accessibility, and add print-friendly styles
*/

/* Toolbar (prints, back-to-top) */
.med-guide-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.85));
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid #e5e7eb; /* gray-200 */
}

/* Ensure buttons look good even if utility classes are missing */
.med-guide-toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--border-radius, 0.75rem);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  border: 1px solid currentColor;
}

/* Sticky filter panel (applied via helper script) */
.med-guide-filters-sticky {
  position: sticky !important;
  top: 72px; /* below sticky toolbar and site header */
  z-index: 30;
  background: rgba(255,255,255,0.96) !important;
  border: 1px solid #e5e7eb !important; /* gray-200 */
  box-shadow: 0 8px 30px rgba(0,0,0,0.06) !important;
  backdrop-filter: saturate(180%) blur(8px);
}

/* Elevate cards and interactive surfaces */
#root .rounded-xl.shadow-lg {
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms cubic-bezier(0.2, 0, 0, 1);
}
#root .rounded-xl.shadow-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.16); /* slate-950-ish */
}

/* Focus visibility for keyboard users */
#root :focus-visible {
  outline: 2px solid var(--primary, #14b8a6) !important; /* teal-500 */
  outline-offset: 2px;
}

/* Tweak headings (subtle tracking, tight leading) */
#root .mobile-heading-2,
#root h1, #root h2 {
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Improve badges/chips legibility */
#root .bg-gray-100, #root .bg-yellow-50 {
  backdrop-filter: saturate(140%);
}

/* Print styles */
@media print {
  /* Hide chrome */
  #site-header, footer, .med-guide-toolbar, .no-print { display: none !important; }
  body, html { background: #ffffff !important; }
  #main-content { padding-top: 0 !important; }

  /* Prefer text over decoration */
  * { box-shadow: none !important; text-shadow: none !important; }
  #root { color: #000 !important; }
  #root a { color: #000 !important; text-decoration: underline; }
  #root a[href]:after { content: " (" attr(href) ")"; font-weight: 400; }

  /* Page breaks for medication details */
  #root [role="gridcell"] { break-inside: avoid; page-break-inside: avoid; }
  #root section, #root article { break-inside: avoid; page-break-inside: avoid; }
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
