/* TotalDeal Help Center — documentation shell (TeamDesk-inspired layout) */

.td-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  animation: td-help-fade-in 0.18s ease-out;
}

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

.td-help-shell {
  flex: 1 1 auto;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface, #ffffff);
  color: var(--text-primary, #0f172a);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-subtle, #e2e8f0);
  overflow: hidden;
}

html[data-theme="dark"] .td-help-shell {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65);
}

.td-help-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}

html[data-theme="dark"] .td-help-top {
  background: var(--surface-elevated, #1e293b);
}

.td-help-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.td-help-brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.td-help-brand-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary, #64748b);
}

.td-help-brand-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.td-help-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 280px;
  justify-content: flex-end;
  min-width: 0;
}

.td-help-search-wrap {
  flex: 1 1 260px;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.td-help-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  pointer-events: none;
  z-index: 1;
}

/* Must be under `.td-help-overlay`: global `input[type="search"]` (styles-polish) is (0,1,1)
   and overrides a lone class, so left padding was 12px and the caret sat left of the icon. */
.td-help-overlay .td-help-search-input[type="search"] {
  box-sizing: border-box !important;
  width: 100% !important;
  display: block !important;
  /* Icon: left 14px + 20px wide → start text after icon + gap */
  padding: 10px 14px 10px 46px !important;
  min-height: 40px !important;
  height: auto !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  border-radius: 9px !important;
  border: 1px solid var(--border-light, #cbd5e1) !important;
  background: var(--surface, #fff) !important;
  color: var(--text-primary, #0f172a) !important;
  outline: none !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}

.td-help-overlay .td-help-search-input[type="search"]::placeholder {
  color: var(--text-secondary, #94a3b8);
}

.td-help-overlay .td-help-search-input[type="search"]:hover {
  border-color: var(--border-strong, #94a3b8);
}

.td-help-overlay .td-help-search-input[type="search"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.td-help-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--text-secondary, #64748b);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.td-help-close:hover {
  background: var(--hover-bg, #f1f5f9);
  color: var(--text-primary, #0f172a);
}

.td-help-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.td-help-sidebar {
  flex: 0 0 280px;
  max-width: 34%;
  border-right: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html[data-theme="dark"] .td-help-sidebar {
  background: var(--surface, #0f172a);
}

.td-help-sidebar-inner {
  padding: 14px 12px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.td-help-search-wrap--header {
  flex: 1 1 260px;
  max-width: 420px;
}

.td-help-sidebar-search {
  flex: 0 0 auto;
  padding: 12px 12px 12px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}

html[data-theme="dark"] .td-help-sidebar-search {
  background: var(--surface, #0f172a);
}

.td-help-search-wrap--sidebar {
  flex: 1 1 auto;
  max-width: none;
  width: 100%;
}

.td-help-section {
  margin-bottom: 18px;
}

.td-help-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary, #64748b);
  padding: 6px 10px 8px;
}

.td-help-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.td-help-nav-link {
  text-align: left;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary, #0f172a);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.td-help-nav-link:hover {
  background: var(--hover-bg, #e2e8f0);
}

.td-help-nav-link.is-active {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-weight: 600;
}

html[data-theme="dark"] .td-help-nav-link.is-active {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.22);
}

.td-help-nav-link--flat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.td-help-nav-link-title {
  font-weight: 600;
}

.td-help-nav-link-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
}

.td-help-search-results-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  padding: 4px 10px 10px;
}

.td-help-empty {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  padding: 12px 10px;
  line-height: 1.5;
}

.td-help-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface, #ffffff);
}

.td-help-article {
  padding: 28px 32px 40px;
  max-width: 720px;
}

.td-help-article-meta {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #2563eb;
  margin-bottom: 10px;
}

.td-help-article-title {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text-primary, #0f172a);
}

.td-help-article-summary {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-secondary, #475569);
  margin: 0 0 24px;
}

.td-help-prose {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary, #1e293b);
}

.td-help-prose p {
  margin: 0 0 14px;
}

.td-help-prose h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary, #0f172a);
  margin: 28px 0 10px;
}

.td-help-prose ul,
.td-help-prose ol {
  margin: 0 0 14px;
  padding-left: 1.25em;
}

.td-help-prose li {
  margin-bottom: 6px;
}

.td-help-prose strong {
  font-weight: 650;
  color: var(--text-primary, #0f172a);
}

.td-help-callout {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 18px 0;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--text-primary, #1e3a8a);
}

html[data-theme="dark"] .td-help-callout {
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.35);
}

.td-help-callout--muted {
  background: var(--surface-2, #f1f5f9);
  border-color: var(--border-subtle, #e2e8f0);
  color: var(--text-secondary, #475569);
}

html[data-theme="dark"] .td-help-callout--muted {
  background: var(--surface-elevated, #1e293b);
  color: var(--text-secondary, #94a3b8);
}

.td-help-related {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
}

.td-help-related-heading {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-primary, #0f172a);
}

.td-help-related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.td-help-related-link {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #cbd5e1);
  background: var(--surface-2, #f8fafc);
  color: #2563eb;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.td-help-related-link:hover {
  background: var(--hover-bg, #e2e8f0);
  border-color: #2563eb;
}

@media (max-width: 768px) {
  .td-help-overlay {
    padding: 0;
    align-items: stretch;
  }

  .td-help-shell {
    border-radius: 0;
    max-width: none;
  }

  /* One search field: sidebar (above list). Header search hidden to avoid duplicates. */
  .td-help-search-wrap--header {
    display: none;
  }

  .td-help-body {
    flex-direction: column;
  }

  .td-help-sidebar {
    flex: 0 0 auto;
    max-width: none;
    max-height: min(38vh, 320px);
    border-right: none;
    border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  }

  .td-help-article {
    padding: 20px 18px 32px;
  }

  .td-help-article-title {
    font-size: 22px;
  }
}
