/* AI customer-service guidance, help, and per-user display preferences. */

.feature-help-trigger {
  min-width: 34px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-hint);
  font: inherit;
  font-size: 9px;
  line-height: 1;
  cursor: help;
}
.feature-help-trigger:hover { background: var(--surface-2); color: var(--text-main); }
.feature-help-trigger:focus-visible { outline: 0; box-shadow: var(--focus-ring); color: var(--text-main); }

.feature-help-popover {
  position: fixed;
  z-index: 240;
  width: min(340px, calc(100vw - 16px));
  max-height: min(70dvh, 430px);
  overflow: auto;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-subtle);
  box-shadow: var(--shadow-soft);
}
.feature-help-popover[hidden] { display: none; }
.feature-help-popover[data-mode="compact"] { width: min(300px, calc(100vw - 16px)); padding-block: 10px; }
.feature-help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feature-help-heading strong { color: var(--text-main); font-size: 13px; }
.feature-help-heading .btn-text { min-height: 28px; }
.feature-help-popover p { margin: 7px 0 0; color: var(--text-subtle); font-size: 11px; line-height: 1.6; }
.feature-help-popover ul { display: grid; gap: 5px; margin: 9px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 11px; line-height: 1.55; }
.feature-help-example { margin-top: 9px; padding: 8px 10px; border-left: 2px solid var(--gold-border); background: var(--surface-2); color: var(--text-muted); font-size: 10px; line-height: 1.55; }

.ai-context-tip {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 210;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.ai-context-tip[hidden] { display: none; }
.ai-context-tip > div { min-width: 0; flex: 1; }
.ai-context-tip strong { color: var(--text-main); font-size: 12px; }
.ai-context-tip p { margin: 4px 0 0; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.ai-context-tip .btn-text { flex: 0 0 auto; min-height: 30px; }

.ai-customer-guide-layer {
  position: fixed;
  inset: 0;
  z-index: 2700;
  pointer-events: none;
}
.ai-customer-guide-layer[hidden] { display: none; }
.ai-customer-guide-spotlight {
  position: fixed;
  border: 2px solid var(--gold-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold-soft) 42%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--surface) 75%, transparent);
  transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}
.ai-customer-guide-card {
  position: fixed;
  width: min(370px, calc(100vw - 24px));
  max-height: min(72dvh, 440px);
  overflow: auto;
  padding: 17px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text-subtle);
  pointer-events: auto;
}
.ai-customer-guide-progress { color: var(--gold-dark); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.ai-customer-guide-card h2 { margin: 7px 0 0; color: var(--text-main); font-size: 17px; line-height: 1.3; }
.ai-customer-guide-card > p { margin: 8px 0 0; color: var(--text-subtle); font-size: 12px; line-height: 1.65; }
.ai-customer-guide-example { margin-top: 10px; padding: 9px 10px; border-left: 2px solid var(--gold-border); background: var(--surface-2); color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.ai-customer-guide-actions { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 7px; margin-top: 15px; }
.ai-customer-guide-actions .btn-primary,
.ai-customer-guide-actions .btn-secondary { min-height: 34px; }

.preference-settings-list { display: grid; gap: 0; margin-top: 16px; border-top: 1px solid var(--border); }
.preference-settings-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 210px); align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.preference-settings-row > span { min-width: 0; display: grid; gap: 4px; }
.preference-settings-row strong { color: var(--text-main); font-size: 12px; }
.preference-settings-row small { color: var(--text-muted); font-size: 10px; line-height: 1.5; }
.preference-settings-row .select-main { width: 100%; min-height: 36px; }
.preference-settings-row > input[type="checkbox"] { justify-self: end; width: 17px; height: 17px; accent-color: var(--gold-dark); }
.preference-settings-actions { display: flex; justify-content: flex-end; padding-top: 14px; }

.ai-guide-search { display: block; margin: 14px 0 10px; }
.ai-guide-search .form-input { width: min(620px, 100%); min-height: 38px; }
.ai-guide-results { display: grid; gap: 8px; margin-top: 14px; }
.ai-guide-module { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ai-guide-module > summary { display: grid; gap: 4px; padding: 12px 14px; list-style: none; cursor: pointer; }
.ai-guide-module > summary::-webkit-details-marker { display: none; }
.ai-guide-module > summary:hover { background: var(--surface-2); }
.ai-guide-module > summary:focus-visible { outline: 0; box-shadow: inset var(--focus-ring); }
.ai-guide-module > summary strong { color: var(--text-main); font-size: 12px; }
.ai-guide-module > summary span { overflow: hidden; color: var(--text-muted); font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.ai-guide-module-body { display: grid; gap: 8px; padding: 0 14px 14px; border-top: 1px solid var(--border); color: var(--text-subtle); font-size: 11px; line-height: 1.6; }
.ai-guide-module-body > * { margin: 0; }
.ai-guide-module-body > p:first-child { padding-top: 12px; }
.ai-guide-module-body ol { display: grid; gap: 4px; margin: 0; padding-left: 20px; color: var(--text-muted); }
.ai-guide-boundary { padding: 8px 10px; border-left: 2px solid var(--gold-border); background: var(--surface-2); }
.ai-guide-setting { color: var(--text-muted); }
.ai-guide-empty { padding: 18px 12px; border: 1px dashed var(--border); border-radius: var(--radius-md); color: var(--text-muted); font-size: 11px; line-height: 1.6; text-align: center; }

.quick-phrases-intro { margin: 8px 0 11px; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.quick-phrases-controls label > span { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.quick-phrases-empty { display: grid; justify-items: center; gap: 6px; padding: 20px 12px; border: 1px dashed var(--border); border-radius: var(--radius-md); color: var(--text-muted); text-align: center; }
.quick-phrases-empty strong { color: var(--text-main); font-size: 12px; }
.quick-phrases-empty span { max-width: 300px; font-size: 10px; line-height: 1.55; }
.quick-phrases-empty .btn-secondary { margin-top: 3px; }
.quick-phrases-popover:has(.quick-phrases-empty) > .quick-phrase-add { display: none; }
.quick-phrase-editor-context { padding: 8px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted); font-size: 9px; line-height: 1.55; }
.quick-phrase-row-actions .danger-text { color: var(--text-muted); }
.quick-phrase-row-actions .danger-text:hover { color: var(--button-danger-text); background: var(--button-danger-bg); }

.empty-chat-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 13px; }
.empty-chat-actions .btn-secondary { min-height: 34px; }

.chat-session-tools-button[hidden] { display: none; }
.chat-session-tools-button { max-width: min(280px, 32vw); }
.chat-session-tools-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .preference-settings-row { grid-template-columns: 1fr; gap: 9px; }
  .preference-settings-row > input[type="checkbox"] { justify-self: start; }
  .preference-settings-actions { justify-content: flex-start; }
  .ai-guide-module > summary span { white-space: normal; }
  .chat-session-tools-button { max-width: 44vw; }
}

@media (max-width: 640px) {
  .feature-help-popover { max-height: 52dvh; }
  .ai-customer-guide-spotlight { border-radius: 9px; }
  .ai-customer-guide-card { max-height: min(48dvh, 380px); border-radius: 14px; }
  .ai-customer-guide-actions { grid-template-columns: auto 1fr auto; }
  .ai-customer-guide-actions > span { display: none; }
  .ai-customer-guide-actions .btn-primary { grid-column: 3; }
  .ai-customer-guide-actions .btn-secondary { grid-column: 2; }
  .ai-context-tip { top: 124px; right: 12px; bottom: auto; }
  .empty-chat-actions { display: grid; grid-template-columns: 1fr; width: min(260px, 100%); }
  .chat-session-tools-button { max-width: 48vw; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-customer-guide-spotlight { transition: none; }
}
