/* ============================================
   🎨 PharmaWeb Core Styles - v2.1
   ✨ Mobile-First | Performance Optimized | Accessibility Ready
   ============================================ */

/* === Font rendering & Inter fallback === */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: local('Inter');
}

/* === Prevent horizontal scroll === */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body { 
  background: hsl(35, 20%, 88%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

/* === LCP optimization: ensure hero images load fast === */
img[fetchpriority="high"],
img.lcp-image {
  content-visibility: visible !important;
}

/* === Reduce layout shift (CLS) === */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

.card-img-top,
.product-image {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
}

.card { 
  border-radius: 1rem; 
  will-change: transform;
}

.navbar { 
  border-bottom-left-radius: 1rem; 
  border-bottom-right-radius: 1rem; 
}

.table { background: hsl(35, 25%, 92%); }

/* === Touch Optimizations for Mobile === */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
}

/* === Focus States for Accessibility === */
*:focus-visible {
  outline: 3px solid rgba(0, 140, 105, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* === Smooth Scroll === */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* === Skip to Content Link for Accessibility === */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 1rem 2rem;
  background: #008c69;
  color: white;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}

/* === Loading States === */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Better Container Padding on Mobile === */
@media (max-width: 576px) {
  .container, .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* === Form Improvements === */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), 
textarea, 
select {
  font-size: 16px !important; /* Prevent iOS zoom */
}

.form-control:focus,
.form-select:focus {
  border-color: #008c69;
  box-shadow: 0 0 0 3px rgba(0, 140, 105, 0.15);
}

/* === Button Improvements === */
.btn {
  transition: all 0.2s ease;
  touch-action: manipulation;
}

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

/* === Image Performance === */
img {
  max-width: 100%;
  height: auto;
  content-visibility: auto;
}

/* === Print Styles === */
@media print {
  .navbar, .footer, .chat-widget, .toast-container {
    display: none !important;
  }
}

/* SEO hidden content - accessible to search engines but hidden from view */
.seo-indexable-content {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

/* === Visually Hidden (Screen Reader Only) === */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
