/* Public Workplace Prompts — scoped overrides.
   Folder panel uses native <dialog>.showModal() matching app calm-folder modal.
   All rules scoped to body.ss-public-chat to prevent app leak.
   v6: measured app parity across desktop/mobile and light/dark states. */

/* ---- Home chips: folder pill — equal inline padding, no arrow child ---- */
body.ss-public-chat #chat-category-chips-container .ss-wp-folder-chip {
  padding-inline: 18px !important;
  gap: 8px !important;
}
body.ss-public-chat #chat-category-chips-container .ss-wp-folder-chip:is(:hover,:focus-visible) {
  transform: none !important;
  box-shadow: none !important;
  color: #3d725f !important;
}
body.ss-public-chat #chat-category-chips-container .ss-wp-folder-chip:is(:hover,:focus-visible) svg {
  color: inherit !important;
}

/* ---- Home chips: create-prompt pill — white/solid subtle border ---- */
body.ss-public-chat .ss-wp-create-chip {
  background: rgba(255,254,251,.85) !important;
  border: 1px solid rgba(228,220,212,.7) !important;
}
body.ss-public-chat #chat-category-chips-container .ss-wp-create-chip {
  padding-inline-start: 30px !important;
  padding-inline-end: 24px !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-create-chip {
  background: rgba(42,38,34,.85) !important;
  border-color: rgba(232,224,216,.12) !important;
}
[data-theme="dark"] body.ss-public-chat #chat-category-chips-container .ss-wp-folder-chip:is(:hover,:focus-visible) {
  color: #b1d3c2 !important;
}

/* ---- Dialog: calm-folder modal ---- */
body.ss-public-chat dialog.ss-wp-dialog {
  max-width: 640px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  inset: 0;
  border: none;
  border-radius: 16px;
  padding: 0;
  background: #fffefb;
  color: #3a2f26;
  box-shadow: 0 16px 56px rgba(58,47,38,.12);
  overflow: hidden;
}

body.ss-public-chat dialog.ss-wp-dialog::backdrop {
  background: rgba(251,249,246,.88);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

body.ss-public-chat .ss-wp-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

/* ---- Header ---- */
body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  flex: none;
  border: none;
  border-bottom: 1px solid rgba(58,47,38,.07);
  background: #faf8f5;
}

body.ss-public-chat .ss-wp-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(110,138,126,.12);
  color: #6e8a7e;
}

body.ss-public-chat .ss-wp-header-icon svg {
  width: 20px;
  height: 20px;
  color: inherit !important;
}

body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-title {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  font-weight: 600;
  padding: 2px 4px;
  line-height: 1.25;
  color: #3a2f26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #9a8e82;
  cursor: pointer;
  padding: 0;
}

body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close:is(:hover,:focus-visible) {
  background: transparent !important;
  box-shadow: none !important;
  color: #3d725f !important;
}

body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close:focus-visible {
  outline: none;
}

/* ---- List ---- */
body.ss-public-chat .ss-wp-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- Row ---- */
body.ss-public-chat .ss-wp-list .chat-prompt-item {
  display: flex;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #ece7df;
  margin: 0;
  border-radius: 0;
  background: transparent !important;
  min-height: 59px;
  gap: 8px;
  height: auto;
}

body.ss-public-chat .ss-wp-list .chat-prompt-item:last-child {
  border-bottom: none;
}

/* Match app polish, overriding the legacy public row hover and divider rules. */
body.ss-public-chat dialog.ss-wp-dialog .ss-wp-list .chat-prompt-item:is(:hover,:focus-within) {
  background: transparent !important;
}
body.ss-public-chat dialog.ss-wp-dialog .ss-wp-list .chat-prompt-item:not(:last-child) {
  border-bottom-color: #ece7df !important;
}

/* ---- Row button ---- */
body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: 44px !important;
  height: auto !important;
  padding: 10px 8px !important;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
  text-align: start;
}

body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn:is(:hover,:focus-visible) {
  color: #3d725f;
}

body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn:focus-visible {
  outline: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn > span:not(.ss-wp-row-icon) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Row icon tile: 28px sage with bookmark ---- */
body.ss-public-chat .ss-wp-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #e8eeea;
  color: #4a7a68;
}

body.ss-public-chat .ss-wp-row-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn:is(:hover,:focus-visible) .ss-wp-row-icon {
  color: #3d725f;
}

/* ---- Footer ---- */
body.ss-public-chat .ss-wp-footer {
  flex: none;
  padding: 16px 24px;
  border-top: 1px solid rgba(58,47,38,.07);
  gap: 10px;
}

body.ss-public-chat .ss-wp-footer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  height: 46px;
  border: 1px solid #e8ddd4;
  border-radius: 12px;
  padding: 0 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
}

body.ss-public-chat .ss-wp-footer-btn:hover {
  background: transparent;
  border-color: #e8ddd4;
}

body.ss-public-chat .ss-wp-footer-btn:focus-visible {
  outline: none;
  background: #f3efe9;
}

body.ss-public-chat .ss-wp-footer-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: #9a8e82;
}

/* ---- Dark mode ---- */
[data-theme="dark"] body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-header {
  background: #302d28;
  border-bottom-color: rgba(255,255,255,.08) !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-dialog .ss-wp-footer-btn:focus-visible {
  background: #39362f;
}

[data-theme="dark"] body.ss-public-chat dialog.ss-wp-dialog {
  background: #2c2925;
  color: #f0e8df;
}
[data-theme="dark"] body.ss-public-chat .ss-wp-dialog-inner {
  color: #e8ddd4;
}

[data-theme="dark"] body.ss-public-chat dialog.ss-wp-dialog::backdrop {
  background: rgba(31,29,26,.88);
}

[data-theme="dark"] body.ss-public-chat .ss-wp-header-icon {
  background: rgba(110,138,126,.16);
  color: #8aafa1;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-title {
  color: rgba(255,254,251,.92) !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn {
  color: rgba(255,254,251,.92) !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close {
  color: rgba(255,254,251,.45) !important;
}

[data-theme="dark"] body.ss-public-chat dialog.ss-wp-dialog .ss-wp-list .chat-prompt-item:not(:last-child) {
  border-bottom-color: #474139 !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn:is(:hover,:focus-visible),
[data-theme="dark"] body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close:is(:hover,:focus-visible) {
  color: #b1d3c2 !important;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-row-icon {
  background: #34473e;
  color: #bad3c6;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn:is(:hover,:focus-visible) .ss-wp-row-icon {
  color: #b1d3c2;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-footer {
  border-top-color: rgba(255,255,255,.08);
}

[data-theme="dark"] body.ss-public-chat .ss-wp-footer-btn {
  border-color: #e8ddd4;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-footer-btn:hover {
  background: transparent;
  border-color: #e8ddd4;
}

[data-theme="dark"] body.ss-public-chat .ss-wp-footer-btn svg {
  color: #9a8e82;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
  body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-header {
    padding: 22px 20px 12px !important;
  }
  body.ss-public-chat .ss-wp-dialog .chat-prompt-panel-close {
    width: 44px !important;
    min-width: 44px !important;
  }
  body.ss-public-chat .ss-wp-footer {
    background: #fffefb;
    border-top-color: rgba(58,47,38,.08);
  }
  body.ss-public-chat .ss-wp-footer-btn {
    box-shadow: 0 4px 12px rgba(110,138,126,.22);
  }
  body.ss-public-chat .ss-wp-footer-btn svg {
    color: #fffefb;
  }
  [data-theme="dark"] body.ss-public-chat .ss-wp-footer {
    background: #2b2a27;
    border-top-color: rgba(255,255,255,.08);
  }
  [data-theme="dark"] body.ss-public-chat .ss-wp-footer-btn {
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
  }
  [data-theme="dark"] body.ss-public-chat .ss-wp-footer-btn svg {
    color: #fffefb;
  }
}
@media (max-width: 480px) {
  body.ss-public-chat .ss-wp-list .chat-prompt-suggestion-btn > span:not(.ss-wp-row-icon) {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  body.ss-public-chat .ss-wp-list {
    padding-inline: 12px;
  }
  body.ss-public-chat dialog.ss-wp-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  body.ss-public-chat .ss-wp-dialog-inner {
    max-height: calc(100dvh - 16px);
  }
}
