/* ==========================================================================
   CASCADE PPE SUPPLY - Custom Design System & Accessible Stylesheet
   Domain: CascadePPESupply.com
   Theme: Clinical Medical-Grade / B2B Supply Chain Resilience
   ========================================================================== */

/* --- Accessibility: Skip to Content Link --- */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 1rem;
  z-index: 9999;
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 0.375rem;
  border: 2px solid #06b6d4;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  transition: top 0.2s ease-in-out;
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

/* --- Global Focus-Visible Treatment (WCAG 2.1 AA compliant) --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

/* Dark background focus elements */
.focus-dark:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* --- Smooth Scrolling & Header Offset --- */
html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 5.5rem;
}

/* --- Cleanroom Grid Backgrounds --- */
.bg-grid-pattern {
  background-size: 32px 32px;
  background-image: 
    linear-gradient(to right, rgba(203, 213, 225, 0.35) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(203, 213, 225, 0.35) 1px, transparent 1px);
}

.bg-grid-pattern-dark {
  background-size: 36px 36px;
  background-image: 
    linear-gradient(to right, rgba(51, 65, 85, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(51, 65, 85, 0.45) 1px, transparent 1px);
}

/* Subtle clean pulse effect for status badge */
@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.08);
  }
}

.animate-pulse-subtle {
  animation: pulse-subtle 2.5s infinite ease-in-out;
}

/* --- Native HTML5 <dialog> Quote Drawer Styles --- */
dialog#quote-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  margin: 0;
  max-width: 480px;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  overflow: hidden;
  display: none;
  z-index: 100;
}

dialog#quote-drawer[open] {
  display: flex;
  flex-direction: column;
}

/* Native dialog backdrop */
dialog#quote-drawer::backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdrop-fade-in 0.25s ease-out forwards;
}

/* Drawer content slide-in animation */
.drawer-content {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  box-shadow: -10px 0 30px -5px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  animation: drawer-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawer-slide-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes backdrop-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Native COA Modal Dialog */
dialog#coa-modal {
  max-width: 680px;
  width: 92%;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  padding: 0;
  overflow: hidden;
  margin: auto;
  z-index: 110;
}

dialog#coa-modal::backdrop {
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

/* --- Range Slider Custom Styling --- */
input[type="range"].custom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  outline: none;
}

input[type="range"].custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0284c7;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"].custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #0369a1;
}

input[type="range"].custom-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0284c7;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

/* --- Interactive File Dropzone States --- */
.dropzone {
  border: 2px dashed #94a3b8;
  transition: all 0.2s ease-in-out;
  background-color: #f8fafc;
}

.dropzone.drag-active {
  border-color: #0284c7;
  background-color: #f0f9ff;
  transform: scale(1.01);
}

/* --- Toast Notification System --- */
.toast-item {
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-in {
  from {
    transform: translateY(1rem) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* --- High Visibility Medical Badges --- */
.badge-clinical {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

/* --- Custom Scrollbar for Drawer & Modal --- */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* --- Form Field Valid / Invalid Treatments --- */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
}

/* --- Reduced Motion Preferences (WCAG) --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .drawer-content {
    animation: none !important;
  }

  dialog#quote-drawer::backdrop {
    animation: none !important;
  }
}

/* --- Print Stylesheet for PO & Quote Summaries --- */
@media print {
  header,
  footer,
  #hero,
  #certifications,
  #about,
  #bulk-ordering,
  .no-print {
    display: none !important;
  }

  body {
    background-color: #ffffff;
    color: #000000;
  }

  #quote-drawer {
    display: block !important;
    position: static !important;
    max-width: 100% !important;
  }
}
