/* FieldBase FORGE Help Panel - rev 1.6.8.3.40 theme polish */
.forge-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: rgba(15, 23, 42, 0.92);
  color: #e0f2fe;
  font-weight: 900;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(8, 47, 73, 0.26);
}

.forge-help-btn:hover,
.forge-help-btn:focus-visible {
  outline: none;
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22), 0 12px 26px rgba(8, 47, 73, 0.35);
  transform: translateY(-1px);
}

.forge-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(7px);
}

.forge-help-overlay.is-open {
  display: flex;
}

.forge-help-modal {
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  background: linear-gradient(145deg, rgba(8, 13, 28, 0.98), rgba(15, 23, 42, 0.98));
  color: #e5f3ff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.forge-help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.forge-help-title h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

.forge-help-title p {
  margin: 8px 0 0;
  color: #bae6fd;
  line-height: 1.45;
}

.forge-help-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.forge-help-body {
  padding: 18px 24px 24px;
  overflow-y: auto;
  max-height: calc(88vh - 112px);
}

.forge-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.forge-help-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.62);
  border-radius: 18px;
  padding: 16px;
}

.forge-help-card strong {
  display: block;
  color: #7dd3fc;
  font-size: 1rem;
  margin-bottom: 7px;
}

.forge-help-card p {
  margin: 0;
  line-height: 1.48;
  color: #dbeafe;
}

.forge-help-note {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 4px solid #38bdf8;
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.12);
  color: #e0f2fe;
}

body:not(.dark-mode) .forge-help-btn,
html.fb-light-preload .forge-help-btn {
  background: #ffffff;
  color: #075985;
  border-color: rgba(2, 132, 199, 0.45);
}

body:not(.dark-mode) .forge-help-modal,
html.fb-light-preload .forge-help-modal {
  background: linear-gradient(145deg, #ffffff, #eef7ff);
  color: #0f172a;
  border-color: rgba(2, 132, 199, 0.25);
}

body:not(.dark-mode) .forge-help-title p,
html.fb-light-preload .forge-help-title p,
body:not(.dark-mode) .forge-help-card p,
html.fb-light-preload .forge-help-card p {
  color: #334155;
}

body:not(.dark-mode) .forge-help-card,
html.fb-light-preload .forge-help-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.1);
}

body:not(.dark-mode) .forge-help-close,
html.fb-light-preload .forge-help-close {
  background: #eff6ff;
  color: #0f172a;
}

@media (max-width: 720px) {
  .forge-help-overlay { padding: 10px; }
  .forge-help-header { padding: 18px 18px 12px; }
  .forge-help-body { padding: 14px 18px 18px; }
  .forge-help-modal { border-radius: 20px; }
}


/* Patch 1.6.8.3.37: keep the FORGE help trigger as a small icon button.
   This prevents the ? button from inheriting wide form/button styles or replacing ASK FORGE. */
.ai-input-row .forge-help-btn,
.forge-help-tools-slot .forge-help-btn,
#forgeHelpButton.forge-help-btn {
  flex: 0 0 34px !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  margin: 0 6px !important;
  border-radius: 999px !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  align-self: center !important;
  box-sizing: border-box !important;
  text-align: center !important;
}

.ai-input-row .forge-help-btn span,
#forgeHelpButton.forge-help-btn span {
  display: block;
  line-height: 1;
  transform: translateY(-1px);
}

.ai-input-row > .primary-btn[type="submit"],
#aiQuestionForm > .primary-btn[type="submit"] {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: max-content !important;
  max-width: max-content !important;
  white-space: nowrap !important;
  align-self: center !important;
}

.ai-input-row textarea,
#aiQuestionInput {
  flex: 1 1 auto;
  min-width: 0;
}

.forge-help-tools-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

@media (max-width: 720px) {
  .ai-input-row .forge-help-btn,
  #forgeHelpButton.forge-help-btn {
    flex-basis: 32px !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    margin: 4px 4px !important;
  }
}


/* Patch 1.6.8.3.39: place ? inside the existing search/mic icon strip and restore centered compose layout. */
#aiQuestionForm.forge-help-icon-inside-input.fieldbase-ai-input-enhanced {
  grid-template-columns: minmax(0, 1fr) !important;
  justify-items: center !important;
  align-items: center !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-wrap {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-self: stretch !important;
}

#aiQuestionForm.forge-help-icon-inside-input .primary-btn[type="submit"] {
  grid-column: 1 / -1 !important;
  justify-self: center !important;
  align-self: center !important;
  width: auto !important;
  min-width: 150px !important;
  max-width: max-content !important;
  margin: 6px auto 0 !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-voice-status,
#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-search-nav {
  grid-column: 1 / -1 !important;
  justify-self: stretch !important;
  width: 100% !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-wrap textarea#aiQuestionInput {
  padding-right: 150px !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn {
  position: static !important;
  flex: 0 0 42px !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 999px !important;
  font-size: 1.02rem !important;
  line-height: 1 !important;
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.14) !important;
}

@media (max-width: 860px) {
  #aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-wrap textarea#aiQuestionInput {
    padding-right: 142px !important;
  }

  #aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn {
    flex-basis: 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }
}


/* Patch 1.6.8.3.40: theme polish for the small ? icon and modal. */
#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn,
.fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn,
#forgeHelpButton.forge-help-btn {
  background: rgba(15, 23, 42, 0.72) !important;
  color: inherit !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
  box-shadow: none !important;
}

#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:hover,
#aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:focus-visible,
.fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:hover,
.fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:focus-visible,
#forgeHelpButton.forge-help-btn:hover,
#forgeHelpButton.forge-help-btn:focus-visible {
  background: rgba(56, 189, 248, 0.16) !important;
  border-color: rgba(125, 211, 252, 0.55) !important;
  color: inherit !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16) !important;
  transform: none !important;
}

body:not(.dark-mode) #aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn,
body:not(.dark-mode) .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn,
body:not(.dark-mode) #forgeHelpButton.forge-help-btn,
html.fb-light-preload #forgeHelpButton.forge-help-btn {
  background: rgba(255, 255, 255, 0.72) !important;
  color: inherit !important;
  border-color: rgba(15, 23, 42, 0.16) !important;
}

body:not(.dark-mode) #aiQuestionForm.forge-help-icon-inside-input .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:hover,
body:not(.dark-mode) .fieldbase-ai-input-icons #forgeHelpButton.forge-help-btn:hover,
body:not(.dark-mode) #forgeHelpButton.forge-help-btn:hover,
html.fb-light-preload #forgeHelpButton.forge-help-btn:hover,
body:not(.dark-mode) #forgeHelpButton.forge-help-btn:focus-visible,
html.fb-light-preload #forgeHelpButton.forge-help-btn:focus-visible {
  background: rgba(2, 132, 199, 0.10) !important;
  border-color: rgba(2, 132, 199, 0.32) !important;
  color: inherit !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12) !important;
}

body.dark-mode .forge-help-modal,
html:not(.fb-light-preload) body.dark-mode .forge-help-modal {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98)) !important;
  color: #e5edf7 !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

body.dark-mode .forge-help-title h2,
body.dark-mode .forge-help-card strong,
body.dark-mode .forge-help-note strong {
  color: #e5edf7 !important;
}

body.dark-mode .forge-help-title p,
body.dark-mode .forge-help-card p,
body.dark-mode .forge-help-note {
  color: #cbd5e1 !important;
}

body.dark-mode .forge-help-card {
  background: rgba(30, 41, 59, 0.58) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
}

body.dark-mode .forge-help-close {
  background: rgba(30, 41, 59, 0.76) !important;
  color: #e5edf7 !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}

body.dark-mode .forge-help-note {
  background: rgba(56, 189, 248, 0.08) !important;
  border-left-color: rgba(56, 189, 248, 0.65) !important;
}

body:not(.dark-mode) .forge-help-overlay,
html.fb-light-preload .forge-help-overlay {
  background: rgba(15, 23, 42, 0.42) !important;
}

body:not(.dark-mode) .forge-help-modal,
html.fb-light-preload .forge-help-modal {
  background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

body:not(.dark-mode) .forge-help-title h2,
body:not(.dark-mode) .forge-help-card strong,
html.fb-light-preload .forge-help-title h2,
html.fb-light-preload .forge-help-card strong {
  color: #0f172a !important;
}

body:not(.dark-mode) .forge-help-title p,
body:not(.dark-mode) .forge-help-card p,
body:not(.dark-mode) .forge-help-note,
html.fb-light-preload .forge-help-title p,
html.fb-light-preload .forge-help-card p,
html.fb-light-preload .forge-help-note {
  color: #334155 !important;
}

body:not(.dark-mode) .forge-help-card,
html.fb-light-preload .forge-help-card {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
}

body:not(.dark-mode) .forge-help-note,
html.fb-light-preload .forge-help-note {
  background: rgba(2, 132, 199, 0.08) !important;
  border-left-color: rgba(2, 132, 199, 0.62) !important;
}
