/* ========================================
   HELP COMPONENTS - Accessible Styles
   ======================================== */

/* ----------------------------------------
   Help Icon - Small question mark button
   ---------------------------------------- */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(109, 40, 217, 0.12);
  color: #6d28d9;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  vertical-align: middle;
  margin-left: 4px;
  border: 1px solid rgba(109, 40, 217, 0.2);
  user-select: none;
}

.help-icon:hover {
  background: rgba(109, 40, 217, 0.2);
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.25);
}

.help-icon:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.help-icon:active {
  transform: scale(0.95);
}

.help-icon-symbol {
  line-height: 1;
}

/* ----------------------------------------
   Help Tooltip - Dark tooltip on hover
   ---------------------------------------- */
.help-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 280px;
  padding: 8px 12px;
  background: #1a1a2e;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.help-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.help-tooltip::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent #1a1a2e transparent;
}

/* ----------------------------------------
   Inline Help - Helper text under controls
   ---------------------------------------- */
.inline-help {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
}

.inline-help-text {
  flex: 1;
}

.inline-help-more {
  background: none;
  border: none;
  color: #6d28d9;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.inline-help-more:hover {
  color: #5b21b6;
}

.inline-help-more:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ----------------------------------------
   Help Panel - Right-side drawer
   ---------------------------------------- */
.help-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.help-panel.open {
  transform: translateX(0);
}

body.help-panel-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .help-panel {
    width: 100%;
  }
}

/* ----------------------------------------
   Help Panel Header
   ---------------------------------------- */
.help-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #581c87 0%, #1e3a8a 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.help-panel-search {
  flex: 1;
}

.help-panel-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.help-panel-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.help-panel-search-input:focus {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.help-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.help-panel-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.help-panel-close:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ----------------------------------------
   Help Panel Content Area
   ---------------------------------------- */
.help-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.help-panel-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
  text-align: center;
}

/* ----------------------------------------
   Help Topic Display
   ---------------------------------------- */
.help-topic {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.help-topic-header {
  margin-bottom: 16px;
}

.help-topic-category {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(109, 40, 217, 0.1);
  color: #6d28d9;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.help-topic-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #1a1a2e;
  font-weight: 600;
}

.help-topic-body {
  margin-bottom: 20px;
  color: #4a5568;
  line-height: 1.6;
}

.help-topic-body p {
  margin: 0;
}

/* ----------------------------------------
   Help Topic Sections
   ---------------------------------------- */
.help-topic-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.help-topic-section:last-of-type {
  border-bottom: none;
}

.help-topic-section h4 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.help-topic-steps {
  margin: 0;
  padding-left: 20px;
  color: #4a5568;
}

.help-topic-steps li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.help-topic-issues {
  margin: 0;
  padding-left: 18px;
  color: #4a5568;
  list-style-type: disc;
}

.help-topic-issues li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ----------------------------------------
   Related Topics Links
   ---------------------------------------- */
.help-topic-related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.help-related-link {
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #4a5568;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-related-link:hover {
  background: #e5e7eb;
  color: #1a1a2e;
}

.help-related-link:focus {
  outline: 2px solid #6d28d9;
  outline-offset: 2px;
}

/* ----------------------------------------
   Help Topic Footer
   ---------------------------------------- */
.help-topic-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.help-topic-updated {
  font-size: 12px;
  color: #9ca3af;
}

/* ----------------------------------------
   Help Panel Footer
   ---------------------------------------- */
.help-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.help-panel-copy-btn {
  padding: 8px 16px;
  background: #6d28d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.help-panel-copy-btn:hover {
  background: #5b21b6;
}

.help-panel-copy-btn:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.help-panel-copy-btn.success {
  background: #059669;
}

.help-panel-copy-btn.error {
  background: #dc2626;
}

.help-panel-guidance-label {
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
}

/* ----------------------------------------
   Search Results
   ---------------------------------------- */
.help-search-results {
  animation: fadeIn 0.2s ease;
}

.help-search-count {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px 0;
}

.help-search-no-results {
  text-align: center;
  color: #6b7280;
  padding: 40px 0;
}

.help-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-search-list li {
  margin-bottom: 12px;
}

.help-search-result {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-search-result:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.help-search-result:focus {
  outline: 2px solid #6d28d9;
  outline-offset: 2px;
}

.help-search-result-category {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6d28d9;
  margin-bottom: 4px;
}

.help-search-result-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.help-search-result-tooltip {
  display: block;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

/* ----------------------------------------
   Screen Reader Only (Accessibility)
   ---------------------------------------- */
.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;
}

/* ----------------------------------------
   Focus Visible (Keyboard Navigation)
   ---------------------------------------- */
.help-icon:focus-visible,
.help-panel-close:focus-visible,
.help-panel-copy-btn:focus-visible,
.help-related-link:focus-visible,
.help-search-result:focus-visible,
.inline-help-more:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* ----------------------------------------
   Reduced Motion Preference
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .help-panel {
    transition: none;
  }
  
  .help-topic,
  .help-search-results {
    animation: none;
  }
  
  .help-icon,
  .help-related-link,
  .help-search-result {
    transition: none;
  }
}

/* ----------------------------------------
   High Contrast Mode Support
   ---------------------------------------- */
@media (prefers-contrast: high) {
  .help-icon {
    border: 2px solid #6d28d9;
  }
  
  .help-tooltip {
    border: 2px solid #fff;
  }
  
  .help-panel {
    border-left: 2px solid #1a1a2e;
  }
  
  .help-search-result {
    border: 2px solid #1a1a2e;
  }
}

/* ----------------------------------------
   Print Styles
   ---------------------------------------- */
@media print {
  .help-icon,
  .help-panel,
  .help-tooltip {
    display: none !important;
  }
}
