/**
 * MedBackend - Optimized Stylesheet
 * Contains performance-optimized styles for better rendering and transitions
 */

/* Font Display Strategy - Ensure text is visible during webfont load */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap; /* Show text immediately with system font, swap when loaded */
  src: url(https://fonts.gstatic.com/s/inter/v11/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/inter/v11/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/inter/v11/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Page Transition Styles */
html {
  scroll-behavior: smooth;
}

/* Only use scroll-behavior: smooth for non-vestibular users */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Optimized animations - use transforms & opacity only */
.fade-in {
  opacity: 0;
  transform: translateY(10px); /* Reduced from 20px to 10px for subtlety */
  will-change: opacity, transform; /* Hint to browser to optimize */
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Content visibility improvements */
.off-screen-content {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px; /* Initial sizing guess */
}

/* Performance optimized animations */
.slide-in-right {
  opacity: 0;
  transform: translateX(20px); /* Reduced from 50px to 20px */
  will-change: opacity, transform;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-20px); /* Reduced from -50px to -20px */
  will-change: opacity, transform;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Optimized card transitions */
.card-transition {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform, box-shadow;
}

/* Prevent layout shifts */
img, video {
  aspect-ratio: attr(width) / attr(height);
}

/* Animation delays */
.fade-in-delay-1 {
  transition-delay: 0.1s;
}

.fade-in-delay-2 {
  transition-delay: 0.2s;
}

.fade-in-delay-3 {
  transition-delay: 0.3s;
}

.fade-in-delay-4 {
  transition-delay: 0.4s;
}

/* Feature card styles */
.feature-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Button styles */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.4);
}

.btn-outline {
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn-outline:hover {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}

/* Header styles */
.site-header {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.action-btn {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.action-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  transform: translateY(-1px);
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  text-decoration: none;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Image shadows */
.img-shadow {
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Ensure all text is always visible */
h1, h2, h3, h4, h5, h6, p, span, li, a {
  opacity: 1 !important;
  visibility: visible !important;
}

h1, h2, h3, h4, h5, h6 {
  display: block !important;
}

/* Override any fade-in that might hide content */
.fade-in, .slide-in-left, .slide-in-right {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* Hero section specific styles */
.hero-section {
  min-height: 100vh;
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

/* Ensure images are visible */
img {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Enable hardware acceleration for specific animations */
.hardware-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Page transition overlay */
#page-transition-overlay {
  will-change: transform;
}

/* Content is loaded indicator - help with perceived performance */
.content-loaded {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* CSS Animation optimizations - only use opacity and transform */
@keyframes shimmer-optimized {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* Utility classes */
.instant-transition {
  transition: none !important;
}

.reduced-motion {
  transition: none !important;
  animation: none !important;
}

/* Improved heading styles for consistency across all pages */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  opacity: 1 !important;
  visibility: visible !important;
  display: block;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  opacity: 1 !important;
  visibility: visible !important;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

/* Documentation card icons styling */
.doc-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
  box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.doc-icon:before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.doc-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.3);
}

.doc-icon:hover:before {
  transform: translateX(100%);
}

/* Documentation section feature icons */
.feature-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  background-size: 200% 200%;
  animation: gradientShift 7s ease infinite;
  box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-icon:before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.feature-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.3);
}

.feature-icon:hover:before {
  transform: translateX(100%);
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Fix subtitle display in light theme */
html.light-theme h2, 
html.light-theme h3 {
  color: var(--text-color);
}

/* Enhanced contrast for badges and integrations - Light Theme */
html.light-theme .badge-fhir {
  background-color: rgba(16, 185, 129, 0.25);
  color: #047857; /* Much darker green for better contrast */
  border-color: rgba(16, 185, 129, 0.5);
  font-weight: 600;
}

html.light-theme .badge-hipaa {
  background-color: rgba(220, 38, 38, 0.25);
  color: #7F1D1D; /* Much darker red for better contrast */
  border-color: rgba(220, 38, 38, 0.5);
  font-weight: 600;
}

html.light-theme .badge-gdpr {
  background-color: rgba(37, 99, 235, 0.25);
  color: #1E3A8A; /* Much darker blue for better contrast */
  border-color: rgba(37, 99, 235, 0.5);
  font-weight: 600;
}

html.light-theme .badge-onc {
  background-color: rgba(124, 58, 237, 0.25);
  color: #4C1D95; /* Much darker purple for better contrast */
  border-color: rgba(124, 58, 237, 0.5);
  font-weight: 600;
}

html.light-theme .badge-iso {
  background-color: rgba(245, 158, 11, 0.25);
  color: #92400E; /* Much darker amber for better contrast */
  border-color: rgba(245, 158, 11, 0.5);
  font-weight: 600;
}

/* Enhanced contrast for badges and integrations - Dark Theme */
.badge-fhir {
  background-color: rgba(16, 185, 129, 0.25);
  color: #A7F3D0; /* Much brighter green for dark backgrounds */
  border: 1px solid rgba(16, 185, 129, 0.5);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.badge-hipaa {
  background-color: rgba(220, 38, 38, 0.25);
  color: #FECACA; /* Much brighter red for dark backgrounds */
  border: 1px solid rgba(220, 38, 38, 0.5);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.badge-gdpr {
  background-color: rgba(59, 130, 246, 0.25);
  color: #BFDBFE; /* Much brighter blue for dark backgrounds */
  border: 1px solid rgba(59, 130, 246, 0.5);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.badge-onc {
  background-color: rgba(139, 92, 246, 0.25);
  color: #E0E7FF; /* Much brighter purple for dark backgrounds */
  border: 1px solid rgba(139, 92, 246, 0.5);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.badge-iso {
  background-color: rgba(245, 158, 11, 0.25);
  color: #FEF3C7; /* Much brighter amber for dark backgrounds */
  border: 1px solid rgba(245, 158, 11, 0.5);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Section headings with icons */
h2.flex, h3.flex {
  display: flex;
  align-items: center;
}

/* Responsive text size adjustments for better performance */
@media (max-width: 640px) {
  h1 { font-size: 2rem !important; } /* Slightly smaller on mobile */
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
}

/* Loading indicator that doesn't cause layout shifts */
.loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: 40px;
  height: 40px;
}

/* Prefers reduced motion adjustments */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Code block styling fixes for light theme */
html.light-theme .relative.overflow-hidden.rounded-xl.border.border-gray-700\/50.shadow-2xl.bg-\[var\(--card-background\)\] {
  background-color: #1A1E2E !important; /* Keep a dark background for code blocks in light theme */
}

html.light-theme .p-6.bg-black\/30 {
  background-color: #15182A !important; /* Darker header for code blocks in light theme */
}

html.light-theme .p-6.font-mono.text-sm.text-gray-300 {
  color: #E5E7EB !important; /* Ensure code text remains white in light theme */
}

/* Line numbers in code blocks */
html.light-theme .font-mono .text-gray-500 {
  color: #9CA3AF !important; /* Brighter gray for line numbers */
}

/* Code syntax colors with better contrast */
html.light-theme .font-mono .text-blue-400 {
  color: #60A5FA !important; /* Brighter blue */
}

html.light-theme .font-mono .text-green-400 {
  color: #34D399 !important; /* Brighter green */
}

html.light-theme .font-mono .text-purple-400 {
  color: #A78BFA !important; /* Brighter purple */
}

html.light-theme .font-mono .text-yellow-300 {
  color: #FCD34D !important; /* Brighter yellow */
} 

/* Header Navigation Styles */
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #6D28D9, #9061F9);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.action-btn:hover {
  background: linear-gradient(135deg, #5B21B6, #7C3AED);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Navigation Links */
nav a {
  color: #D1D5DB;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover {
  color: white;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .site-header .container {
    padding: 0 1rem;
  }
  
  .action-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .icon-btn {
    width: 2rem;
    height: 2rem;
  }
}

/* Theme Toggle and Search Overlay Styles */
#searchOverlay {
  backdrop-filter: blur(8px);
}

#searchOverlay.hidden {
  display: none !important;
}

#searchOverlay:not(.hidden) {
  display: flex !important;
}

/* Light Theme Support */
.theme-light,
html[data-theme="light"] {
  --primary-color: #FFFFFF;
  --secondary-color: #6D28D9;
  --text-color: #111827;
  --background-color: #FFFFFF;
  --card-background: #F9FAFB;
  --border-color: #E5E7EB;
}

.theme-light .site-header,
html[data-theme="light"] .site-header {
  background-color: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #E5E7EB;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-light .logo,
.theme-light nav a,
.theme-light .icon-btn,
html[data-theme="light"] .logo,
html[data-theme="light"] nav a,
html[data-theme="light"] .icon-btn {
  color: #111827;
}

.theme-light .icon-btn,
html[data-theme="light"] .icon-btn {
  background: rgba(0, 0, 0, 0.1);
}

.theme-light .icon-btn:hover,
html[data-theme="light"] .icon-btn:hover {
  background: rgba(0, 0, 0, 0.2);
}

.theme-light nav a:hover,
html[data-theme="light"] nav a:hover {
  color: #6D28D9;
}/* Mo
bile Navigation Styles */
.nav-link {
  color: #D1D5DB;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: white;
}

.mobile-nav-link {
  display: block;
  color: #D1D5DB;
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.2s ease;
}

.mobile-nav-link:hover {
  color: white;
}

.mobile-nav-link:last-child {
  border-bottom: none;
}

/* Mobile Menu Animation */
#mobileMenu {
  transition: all 0.3s ease;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}

#mobileMenu.show {
  max-height: 500px;
  opacity: 1;
  visibility: visible;
}

/* Sidebar improvements */
.sidebar-item {
  transition: all 0.2s ease;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
}

.sidebar-item:hover {
  background-color: rgba(109, 40, 217, 0.1);
  transform: translateX(3px);
}

/* Light theme mobile navigation */
.theme-light #mobileMenu,
html[data-theme="light"] #mobileMenu {
  background-color: #F9FAFB;
  border-top: 1px solid #E5E7EB;
}

.theme-light .mobile-nav-link,
html[data-theme="light"] .mobile-nav-link {
  color: #374151;
  border-bottom: 1px solid #E5E7EB;
}

.theme-light .mobile-nav-link:hover,
html[data-theme="light"] .mobile-nav-link:hover {
  color: #6D28D9;
}

.theme-light .nav-link,
html[data-theme="light"] .nav-link {
  color: #374151;
}

.theme-light .nav-link:hover,
html[data-theme="light"] .nav-link:hover {
  color: #6D28D9;
}
