/* ==========================================================================
   MATRIX OSINT IN-APP HELP SYSTEM, POPOVERS & GUIDED TOUR STYLES
   Light theme matching #F6F7F9 background, #FFFFFF cards, #E1E5EC borders
   ========================================================================== */

/* --- 1. Small (i) Info Buttons --- */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  min-width: 17px;
  border-radius: 50%;
  border: 1px solid #CBD5E1;
  background-color: #FFFFFF;
  color: #64748B;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  font-style: italic;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.15s ease;
  line-height: 1;
}

.info-btn:hover {
  background-color: #EFF6FF;
  border-color: #2F6FED;
  color: #2F6FED;
  transform: scale(1.05);
}

.info-btn:focus-visible {
  outline: none;
  border-color: #2F6FED;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.25);
}

/* Active blue pill state (matches reference mockup) */
.info-btn.active,
.info-btn[aria-expanded="true"] {
  background-color: #2F6FED;
  border-color: #2F6FED;
  color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.22);
}

/* --- 2. Dark Slate Popover (Reference Mockup) --- */
.help-popover {
  position: absolute;
  z-index: 9999;
  width: 270px;
  max-width: calc(100vw - 32px);
  background-color: #111827;
  color: #F9FAFB;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid #374151;
  animation: popoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-popover-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-popover-text {
  color: #E2E8F0;
  margin-bottom: 8px;
}

.help-popover-source {
  font-size: 11px;
  color: #94A3B8;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 6px;
  margin-bottom: 8px;
  padding-top: 6px;
  border-top: 1px solid #1F2937;
  word-break: break-word;
}

.help-popover-source-label {
  color: #64748B;
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.help-popover-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.help-popover-learn-more {
  color: #60A5FA;
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.12s ease;
}

.help-popover-learn-more:hover {
  color: #93C5FD;
}

.help-popover-learn-more:focus-visible {
  outline: 2px solid #60A5FA;
  outline-offset: 2px;
}

.help-popover-close {
  background: none;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease;
}

.help-popover-close:hover {
  color: #FFFFFF;
}

/* Popover Arrow */
.help-popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #111827;
  border: 1px solid #374151;
  transform: rotate(45deg);
}

.help-popover[data-placement^="top"] .help-popover-arrow {
  bottom: -6px;
  border-top: none;
  border-left: none;
}

.help-popover[data-placement^="bottom"] .help-popover-arrow {
  top: -6px;
  border-bottom: none;
  border-right: none;
}

.help-popover[data-placement^="left"] .help-popover-arrow {
  right: -6px;
  border-bottom: none;
  border-left: none;
}

.help-popover[data-placement^="right"] .help-popover-arrow {
  left: -6px;
  border-top: none;
  border-right: none;
}

/* --- 3. Top Bar Help Button --- */
.btn-topbar-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid #E1E5EC;
  background-color: #FFFFFF;
  color: #374151;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-topbar-help:hover {
  background-color: #F8FAFC;
  border-color: #CBD5E1;
  color: #111827;
}

.btn-topbar-help:focus-visible {
  outline: none;
  border-color: #2F6FED;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.2);
}

.btn-topbar-help svg {
  width: 14px;
  height: 14px;
  color: #64748B;
}

/* --- 4. Right-Side Help Slide-Over Panel --- */
.help-panel-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(2px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.help-panel-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.help-slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  background-color: #FFFFFF;
  border-left: 1px solid #E1E5EC;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Panel Header */
.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #E1E5EC;
  background-color: #FAFBFD;
}

.help-panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.help-panel-shortcut-hint {
  font-size: 11px;
  color: #64748B;
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: 'JetBrains Mono', monospace;
}

.help-panel-close-btn {
  background: none;
  border: none;
  color: #64748B;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.help-panel-close-btn:hover {
  background-color: #F1F5F9;
  color: #111827;
}

.help-panel-close-btn:focus-visible {
  outline: 2px solid #2F6FED;
}

/* Panel Search */
.help-panel-search-box {
  padding: 14px 20px 10px;
  border-bottom: 1px solid #F1F5F9;
  position: relative;
}

.help-search-icon {
  position: absolute;
  left: 32px;
  top: 24px;
  width: 15px;
  height: 15px;
  color: #94A3B8;
  pointer-events: none;
}

.help-search-input {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 1px solid #CBD5E1;
  background-color: #F8FAFC;
  padding: 0 12px 0 34px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #111827;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.help-search-input:focus {
  outline: none;
  border-color: #2F6FED;
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.help-search-input::placeholder {
  color: #94A3B8;
}

/* Panel Body */
.help-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 30px;
}

.help-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  margin: 16px 0 10px;
}

.help-section-title:first-child {
  margin-top: 0;
}

.help-topic-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #E1E5EC;
  background-color: #FFFFFF;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-topic-item:hover {
  background-color: #F8FAFC;
  border-color: #CBD5E1;
  transform: translateY(-1px);
}

.help-topic-item:focus-visible {
  outline: none;
  border-color: #2F6FED;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.2);
}

.help-topic-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  color: #2F6FED;
  margin-top: 1px;
}

.help-topic-content {
  flex: 1;
}

.help-topic-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}

.help-topic-desc {
  font-size: 12px;
  color: #4B5563;
  line-height: 1.45;
}

.help-topic-source {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: #94A3B8;
  margin-top: 4px;
}

/* Glossary Card & Shortcuts Table */
.help-glossary-card {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #E1E5EC;
  background-color: #FAFBFD;
  margin-bottom: 8px;
}

.help-glossary-term {
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-glossary-pill {
  font-size: 10px;
  background-color: #E2E8F0;
  color: #334155;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.help-glossary-def {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.help-shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}

.help-shortcuts-table tr {
  border-bottom: 1px solid #F1F5F9;
}

.help-shortcuts-table td {
  padding: 8px 4px;
}

.help-kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #1E293B;
  background-color: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* --- 5. Guided Tour Card & Spotlight (Reference Mockup) --- */
.tour-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(1.5px);
  z-index: 10005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tour-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Target Spotlight Ring */
.tour-spotlight-active {
  position: relative !important;
  z-index: 10006 !important;
  box-shadow: 0 0 0 3px #2F6FED, 0 10px 28px rgba(47, 111, 237, 0.28) !important;
  border-radius: 10px !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease !important;
}

/* Floating Tour Card (Reference Mockup) */
.tour-card {
  display: none;
  position: fixed;
  z-index: 10007;
  width: 320px;
  max-width: calc(100vw - 32px);
  background-color: #F0F7FF;
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.25), 0 4px 10px -2px rgba(0, 0, 0, 0.1);
  font-family: 'Inter', sans-serif;
  animation: tourCardIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.tour-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-step-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #1E40AF;
  letter-spacing: 0.02em;
}

.tour-skip-btn {
  font-size: 12px;
  color: #64748B;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.tour-skip-btn:hover {
  color: #1E293B;
  text-decoration: underline;
}

.tour-card-body {
  font-size: 13px;
  line-height: 1.5;
  color: #1E293B;
  margin-bottom: 14px;
}

.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-actions-left {
  display: flex;
  gap: 8px;
}

.tour-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tour-btn-back {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
}

.tour-btn-back:hover:not(:disabled) {
  background-color: #F8FAFC;
  border-color: #94A3B8;
}

.tour-btn-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tour-btn-next {
  background-color: #2F6FED;
  border: 1px solid #2F6FED;
  color: #FFFFFF;
}

.tour-btn-next:hover {
  background-color: #2563EB;
  border-color: #2563EB;
}

.tour-progress-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #CBD5E1;
  transition: all 0.15s ease;
}

.tour-dot.active {
  background-color: #2F6FED;
  width: 8px;
  height: 8px;
}

/* --- 6. Empty States & Error States --- */
.ct-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 42px 24px;
  border: 1px dashed #CBD5E1;
  border-radius: 12px;
  background-color: #FAFBFD;
  margin: 16px 0;
}

.ct-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #EFF6FF;
  color: #2F6FED;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ct-empty-icon svg {
  width: 22px;
  height: 22px;
}

.ct-empty-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 4px;
}

.ct-empty-desc {
  font-size: 13px;
  color: #64748B;
  max-width: 360px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.ct-empty-action-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 7px;
  background-color: #2F6FED;
  border: none;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ct-empty-action-btn:hover {
  background-color: #2563EB;
}

/* Error State */
.ct-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  border: 1px solid #FECACA;
  border-radius: 10px;
  background-color: #FEF2F2;
  margin: 16px 0;
}

.ct-error-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.ct-error-title {
  font-size: 14px;
  font-weight: 600;
  color: #991B1B;
  margin-bottom: 4px;
}

.ct-error-desc {
  font-size: 12.5px;
  color: #7F1D1D;
  margin-bottom: 12px;
  max-width: 340px;
}

.ct-error-retry-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  background-color: #DC2626;
  border: none;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.ct-error-retry-btn:hover {
  background-color: #B91C1C;
}

/* --- 7. Accessible Floating Tooltip (for icon-only buttons) --- */
.accessible-tooltip {
  position: absolute;
  z-index: 10008;
  background-color: #1F2937;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform: translateY(2px);
}

.accessible-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile & Accessibility Rules */
@media (max-width: 480px) {
  .help-slide-panel {
    width: 100vw;
    border-left: none;
  }
  .tour-card {
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    bottom: 20px !important;
    top: auto !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-popover,
  .help-slide-panel,
  .tour-card,
  .accessible-tooltip {
    animation: none !important;
    transition: none !important;
  }
}
