/* PureFind Production Enhancements — Accessibility, UX, Polish */

/* Skip to content link */
.pf-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #7A9E7E;
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  transition: top 0.2s;
}
.pf-skip-link:focus {
  top: 0;
}

/* Focus-visible styles for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 3px solid #7A9E7E;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Ensure visible focus on cards */
.pf-card:focus-visible {
  outline: 3px solid #7A9E7E;
  outline-offset: 4px;
  border-radius: 12px;
}

/* Screen-reader only text */
.pf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Live region for announcements */
.pf-aria-live {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Newsletter styles */
.pf-newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}
.pf-newsletter-form .pf-input-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pf-newsletter-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
}
.pf-newsletter-form input[type="email"]:focus {
  border-color: #7A9E7E;
  box-shadow: 0 0 0 3px rgba(122, 158, 126, 0.15);
}
.pf-newsletter-form button {
  padding: 10px 20px;
  background: #7A9E7E;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.pf-newsletter-form button:hover:not(:disabled) {
  background: #6a8e6e;
}
.pf-newsletter-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.pf-newsletter-form .pf-consent {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.pf-newsletter-form .pf-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.pf-newsletter-form .pf-message.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.pf-newsletter-form .pf-message.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.pf-newsletter-form .pf-message.info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Search overlay */
.pf-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.pf-search-overlay.active {
  display: flex;
}
.pf-search-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.pf-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.pf-search-header input {
  flex: 1;
  border: none;
  font-size: 16px;
  outline: none;
  background: transparent;
}
.pf-search-header kbd {
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
}
.pf-search-results {
  overflow-y: auto;
  padding: 8px 0;
}
.pf-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.pf-search-result:hover,
.pf-search-result:focus {
  background: #f9fafb;
  outline: none;
}
.pf-search-result.selected {
  background: #f3f4f6;
}
.pf-search-result-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}
.pf-search-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
}

/* Quiz styles */
.pf-quiz-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
}
.pf-quiz-progress {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  margin-bottom: 24px;
  overflow: hidden;
}
.pf-quiz-progress-bar {
  height: 100%;
  background: #7A9E7E;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.pf-quiz-question {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #111827;
}
.pf-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pf-quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  text-align: left;
  font-size: 15px;
}
.pf-quiz-option:hover {
  border-color: #7A9E7E;
}
.pf-quiz-option.selected {
  border-color: #7A9E7E;
  background: #f0fdf4;
}
.pf-quiz-option:focus-visible {
  outline: 3px solid #7A9E7E;
  outline-offset: 2px;
}
.pf-quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}
.pf-quiz-nav button {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.pf-quiz-nav .pf-btn-primary {
  background: #7A9E7E;
  color: white;
  border: none;
}
.pf-quiz-nav .pf-btn-primary:hover:not(:disabled) {
  background: #6a8e6e;
}
.pf-quiz-nav .pf-btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}
.pf-quiz-nav .pf-btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
}
.pf-quiz-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pf-quiz-results {
  text-align: center;
  padding: 32px 0;
}
.pf-quiz-results h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}
.pf-quiz-results p {
  color: #6b7280;
  margin-bottom: 24px;
}
.pf-quiz-recommendations {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

/* Filter styles */
.pf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.pf-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pf-filter-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}
.pf-filter-group select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}
.pf-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.pf-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 13px;
  color: #374151;
}
.pf-filter-chip button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: #6b7280;
}
.pf-filter-chip button:hover {
  color: #111827;
}
.pf-clear-filters {
  font-size: 14px;
  color: #7A9E7E;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.pf-clear-filters:hover {
  text-decoration: underline;
}
.pf-result-count {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}
.pf-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #6b7280;
}
.pf-empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

/* Mobile filter drawer */
.pf-filter-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9997;
  display: none;
}
.pf-filter-drawer-overlay.active {
  display: block;
}
.pf-filter-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: white;
  z-index: 9998;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.pf-filter-drawer.active {
  transform: translateX(0);
}
.pf-filter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.pf-filter-drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
}
.pf-filter-drawer-header button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
}

/* Review form styles */
.pf-review-form {
  max-width: 600px;
  margin-top: 24px;
  padding: 24px;
  background: #f9fafb;
  border-radius: 12px;
}
.pf-review-form h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}
.pf-form-group {
  margin-bottom: 16px;
}
.pf-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #374151;
}
.pf-form-group input,
.pf-form-group textarea,
.pf-form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}
.pf-form-group input:focus,
.pf-form-group textarea:focus,
.pf-form-group select:focus {
  border-color: #7A9E7E;
  box-shadow: 0 0 0 3px rgba(122, 158, 126, 0.15);
  outline: none;
}
.pf-form-group textarea {
  min-height: 120px;
  resize: vertical;
}
.pf-star-rating {
  display: flex;
  gap: 4px;
}
.pf-star-rating button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #d1d5db;
  padding: 0;
  line-height: 1;
}
.pf-star-rating button.active {
  color: #fbbf24;
}
.pf-star-rating button:focus-visible {
  outline: 2px solid #7A9E7E;
  border-radius: 4px;
}
.pf-form-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 4px;
}

/* Comparison table improvements */
.pf-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.pf-comparison-table caption {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: left;
}
.pf-comparison-table th,
.pf-comparison-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.pf-comparison-table th {
  font-weight: 600;
  background: #f9fafb;
  color: #374151;
}
.pf-comparison-table td:first-child {
  font-weight: 500;
}
.pf-comparison-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pf-comparison-scroll::-webkit-scrollbar {
  height: 8px;
}
.pf-comparison-scroll::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}
.pf-comparison-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* Product card improvements */
.pf-card {
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.pf-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.pf-card .pf-card-meta {
  pointer-events: none;
}
.pf-card .pf-card-meta a,
.pf-card .pf-card-meta button {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

/* Price and rating formatting helpers */
.pf-price {
  font-weight: 600;
  color: #111827;
}
.pf-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pf-rating-stars {
  color: #fbbf24;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible {
    outline: 3px solid currentColor;
  }
}
