/*
 * Trix / Action Text styles.
 * The first section is the Rails default. The "Portal Trix overrides"
 * section below reskins the toolbar for the portal's frosted-glass
 * aesthetic using SF Symbol SVGs.
 */

/* ── Default Trix styles (Rails scaffold) ─────────────────────────────── */

trix-editor {
  border: 1px solid #bbb;
  border-radius: 3px;
  margin: 0;
  padding: 0.4em 0.6em;
  min-height: 5em;
  outline: none;
}

trix-toolbar * {
  box-sizing: border-box;
}

trix-toolbar .trix-button-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  overflow-x: auto;
}

trix-toolbar .trix-button-group {
  display: flex;
  margin-bottom: 10px;
  border: 1px solid #bbb;
  border-top-color: #ccc;
  border-bottom-color: #888;
  border-radius: 3px;
}
  trix-toolbar .trix-button-group:not(:first-child) {
    margin-left: 1.5vw;
  }
    @media (max-width: 768px) {
      trix-toolbar .trix-button-group:not(:first-child) {
        margin-left: 0;
      }
    }

trix-toolbar .trix-button-group-spacer {
  flex-grow: 1;
}
  @media (max-width: 768px) {
    trix-toolbar .trix-button-group-spacer {
      display: none;
    }
  }

trix-toolbar .trix-button {
  position: relative;
  float: left;
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.75em;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 0.5em;
  margin: 0;
  outline: none;
  border: none;
  border-bottom: 1px solid #ddd;
  border-radius: 0;
  background: transparent;
}
  trix-toolbar .trix-button:not(:first-child) {
    border-left: 1px solid #ccc;
  }
  trix-toolbar .trix-button.trix-active {
    background: #cbeefa;
    color: black;
  }
  trix-toolbar .trix-button:not(:disabled) {
    cursor: pointer;
  }
  trix-toolbar .trix-button:disabled {
    color: rgba(0, 0, 0, 0.125);
  }

trix-toolbar .trix-button--icon {
  font-size: inherit;
  width: 2.6em;
  height: 1.6em;
  max-width: calc(0.8em + 4vw);
  text-indent: -9999px;
}
  trix-toolbar .trix-button--icon::before {
    display: inline-block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.6;
    content: "";
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }
  trix-toolbar .trix-button--icon.trix-active::before {
    opacity: 1;
  }
  trix-toolbar .trix-button--icon:disabled::before {
    opacity: 0.125;
  }

trix-toolbar .trix-button--icon-attach::before {
  background-image: url("sfsymbols/paperclip.svg");
  top: 8%;
  bottom: 4%;
}

trix-toolbar .trix-button--icon-bold::before {
  background-image: url("sfsymbols/bold.svg");
}

trix-toolbar .trix-button--icon-italic::before {
  background-image: url("sfsymbols/italic.svg");
}

trix-toolbar .trix-button--icon-link::before {
  background-image: url("sfsymbols/link.svg");
}

trix-toolbar .trix-button--icon-strike::before {
  background-image: url("sfsymbols/strikethrough.svg");
}

trix-toolbar .trix-button--icon-quote::before {
  background-image: url("sfsymbols/text.quote.svg");
}

trix-toolbar .trix-button--icon-heading-1::before {
  background-image: url("sfsymbols/text.page.svg");
}

trix-toolbar .trix-button--icon-code::before {
  background-image: url("sfsymbols/chevron.left.forwardslash.chevron.right.svg");
}

trix-toolbar .trix-button--icon-bullet-list::before {
  background-image: url("sfsymbols/list.bullet.svg");
}

trix-toolbar .trix-button--icon-number-list::before {
  background-image: url("sfsymbols/list.number.svg");
}

trix-toolbar .trix-button--icon-undo::before {
  background-image: url("sfsymbols/arrow.uturn.backward.svg");
}

trix-toolbar .trix-button--icon-redo::before {
  background-image: url("sfsymbols/arrow.uturn.forward.svg");
}

trix-toolbar .trix-button--icon-decrease-nesting-level::before {
  background-image: url("sfsymbols/decrease.indent.svg");
}

trix-toolbar .trix-button--icon-increase-nesting-level::before {
  background-image: url("sfsymbols/increase.indent.svg");
}

trix-toolbar .trix-dialogs {
  position: relative;
}

trix-toolbar .trix-dialog {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 0.75em;
  padding: 15px 10px;
  background: #fff;
  box-shadow: 0 0.3em 1em #ccc;
  border-top: 2px solid #888;
  border-radius: 5px;
  z-index: 5;
}

trix-toolbar .trix-input--dialog {
  font-size: inherit;
  font-weight: normal;
  padding: 0.5em 0.8em;
  margin: 0 10px 0 0;
  border-radius: 3px;
  border: 1px solid #bbb;
  background-color: #fff;
  box-shadow: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
  trix-toolbar .trix-input--dialog.validate:invalid {
    box-shadow: #F00 0px 0px 1.5px 1px;
  }

trix-toolbar .trix-button--dialog {
  font-size: inherit;
  padding: 0.5em;
  border-bottom: none;
}

trix-toolbar .trix-dialog--link {
  max-width: 600px;
}

trix-toolbar .trix-dialog__link-fields {
  display: flex;
  align-items: baseline;
}
  trix-toolbar .trix-dialog__link-fields .trix-input {
    flex: 1;
  }
  trix-toolbar .trix-dialog__link-fields .trix-button-group {
    flex: 0 0 content;
    margin: 0;
  }

/* ── Trix editor content styles ───────────────────────────────────────── */

trix-editor [data-trix-mutable]:not(.attachment__caption-editor) {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

trix-editor [data-trix-mutable]::-moz-selection,
trix-editor [data-trix-cursor-target]::-moz-selection, trix-editor [data-trix-mutable] ::-moz-selection {
  background: none;
}

trix-editor [data-trix-mutable]::selection,
trix-editor [data-trix-cursor-target]::selection, trix-editor [data-trix-mutable] ::selection {
  background: none;
}

trix-editor .attachment__caption-editor:focus[data-trix-mutable]::-moz-selection {
  background: highlight;
}

trix-editor .attachment__caption-editor:focus[data-trix-mutable]::selection {
  background: highlight;
}

trix-editor [data-trix-mutable].attachment.attachment--file {
  box-shadow: 0 0 0 2px highlight;
  border-color: transparent;
}

trix-editor [data-trix-mutable].attachment img {
  box-shadow: 0 0 0 2px highlight;
}

trix-editor .attachment {
  position: relative;
}
  trix-editor .attachment:hover {
    cursor: default;
  }

trix-editor .attachment--preview .attachment__caption:hover {
  cursor: text;
}

trix-editor .attachment__progress {
  position: absolute;
  z-index: 1;
  height: 20px;
  top: calc(50% - 10px);
  left: 5%;
  width: 90%;
  opacity: 0.9;
  transition: opacity 200ms ease-in;
}
  trix-editor .attachment__progress[value="100"] {
    opacity: 0;
  }

trix-editor .attachment__caption-editor {
  display: inline-block;
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  color: inherit;
  text-align: center;
  vertical-align: top;
  border: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

trix-editor .attachment__toolbar {
  position: absolute;
  z-index: 1;
  top: -0.9em;
  left: 0;
  width: 100%;
  text-align: center;
}

trix-editor .trix-button-group {
  display: inline-flex;
}

trix-editor .trix-button {
  position: relative;
  float: left;
  color: #666;
  white-space: nowrap;
  font-size: 80%;
  padding: 0 0.8em;
  margin: 0;
  outline: none;
  border: none;
  border-radius: 0;
  background: transparent;
}
  trix-editor .trix-button:not(:first-child) {
    border-left: 1px solid #ccc;
  }
  trix-editor .trix-button.trix-active {
    background: #cbeefa;
  }
  trix-editor .trix-button:not(:disabled) {
    cursor: pointer;
  }

trix-editor .trix-button--remove {
  text-indent: -9999px;
  display: inline-block;
  padding: 0;
  outline: none;
  width: 1.8em;
  height: 1.8em;
  line-height: 1.8em;
  border-radius: 50%;
  background-color: #fff;
  border: 2px solid highlight;
  box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25);
}
  trix-editor .trix-button--remove::before {
    display: inline-block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.7;
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg%20height%3D%2224%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22%2F%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 90%;
  }
  trix-editor .trix-button--remove:hover {
    border-color: #333;
  }
    trix-editor .trix-button--remove:hover::before {
      opacity: 1;
    }

trix-editor .attachment__metadata-container {
  position: relative;
}

trix-editor .attachment__metadata {
  position: absolute;
  left: 50%;
  top: 2em;
  transform: translate(-50%, 0);
  max-width: 90%;
  padding: 0.1em 0.6em;
  font-size: 0.8em;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 3px;
}
  trix-editor .attachment__metadata .attachment__name {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  trix-editor .attachment__metadata .attachment__size {
    margin-left: 0.2em;
    white-space: nowrap;
  }

.trix-content {
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}
  .trix-content * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  .trix-content h1 {
    font-size: 1.2em;
    line-height: 1.2;
  }
  .trix-content blockquote {
    border: 0 solid #ccc;
    border-left-width: 0.3em;
    margin-left: 0.3em;
    padding-left: 0.6em;
  }
  .trix-content [dir=rtl] blockquote,
  .trix-content blockquote[dir=rtl] {
    border-width: 0;
    border-right-width: 0.3em;
    margin-right: 0.3em;
    padding-right: 0.6em;
  }
  .trix-content li {
    margin-left: 1em;
  }
  .trix-content [dir=rtl] li {
    margin-right: 1em;
  }
  .trix-content pre {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    font-family: monospace;
    font-size: 0.9em;
    padding: 0.5em;
    white-space: pre;
    background-color: #eee;
    overflow-x: auto;
  }
  .trix-content img {
    max-width: 100%;
    height: auto;
  }
  .trix-content .attachment {
    display: inline-block;
    position: relative;
    max-width: 100%;
  }
    .trix-content .attachment a {
      color: inherit;
      text-decoration: none;
    }
      .trix-content .attachment a:hover, .trix-content .attachment a:visited:hover {
        color: inherit;
      }
  .trix-content .attachment__caption {
    text-align: center;
  }
    .trix-content .attachment__caption .attachment__name + .attachment__size::before {
      content: ' \2022 ';
    }
  .trix-content .attachment--preview {
    width: 100%;
    text-align: center;
  }
    .trix-content .attachment--preview .attachment__caption {
      color: #666;
      font-size: 0.9em;
      line-height: 1.2;
    }
  .trix-content .attachment--file {
    color: #333;
    line-height: 1;
    margin: 0 2px 2px 2px;
    padding: 0.4em 1em;
    border: 1px solid #bbb;
    border-radius: 5px;
  }
  .trix-content .attachment-gallery {
    display: flex;
    flex-wrap: wrap;
    position: relative;
  }
    .trix-content .attachment-gallery .attachment {
      flex: 1 0 33%;
      padding: 0 0.5em;
      max-width: 33%;
    }
    .trix-content .attachment-gallery.attachment-gallery--2 .attachment, .trix-content .attachment-gallery.attachment-gallery--4 .attachment {
      flex-basis: 50%;
      max-width: 50%;
    }

.trix-content .attachment-gallery > action-text-attachment,
.trix-content .attachment-gallery > .attachment {
  flex: 1 0 33%;
  padding: 0 0.5em;
  max-width: 33%;
}

.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
  flex-basis: 50%;
  max-width: 50%;
}

.trix-content action-text-attachment .attachment {
  padding: 0 !important;
  max-width: 100% !important;
}

/* ══════════════════════════════════════════════════════════════════════════
 * Portal Trix overrides
 * ══════════════════════════════════════════════════════════════════════════
 * When a Trix editor sits inside the portal (c-textarea or
 * review-form), the toolbar gets a frosted, icon-only pill-bar
 * treatment. SF Symbol SVGs are referenced above in the icon
 * ::before rules.
 */

/* Toolbar row — pills with gaps instead of a monolithic bordered strip */
.reviews-section trix-toolbar .trix-button-row,
.profile-container trix-toolbar .trix-button-row,
.owned-edit trix-toolbar .trix-button-row {
  gap: 0.35rem;
  justify-content: flex-start;
}

.reviews-section trix-toolbar .trix-button-group,
.profile-container trix-toolbar .trix-button-group,
.owned-edit trix-toolbar .trix-button-group {
  border: none;
  border-radius: var(--radius-round, 9999px);
  background: rgb(0 0 0 / 0.06);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.reviews-section trix-toolbar .trix-button,
.profile-container trix-toolbar .trix-button,
.owned-edit trix-toolbar .trix-button {
  border: none;
  border-bottom: none;
  border-left: none;
  padding: 0;
  background: transparent;
  color: rgb(20 20 30 / 0.65);
}

.reviews-section trix-toolbar .trix-button:not(:first-child),
.profile-container trix-toolbar .trix-button:not(:first-child),
.owned-edit trix-toolbar .trix-button:not(:first-child) {
  border-left: none;
}

.reviews-section trix-toolbar .trix-button.trix-active,
.profile-container trix-toolbar .trix-button.trix-active,
.owned-edit trix-toolbar .trix-button.trix-active {
  background: rgb(0 0 0 / 0.12);
  color: rgb(20 20 30 / 0.95);
}

.reviews-section trix-toolbar .trix-button:hover:not(:disabled),
.profile-container trix-toolbar .trix-button:hover:not(:disabled),
.owned-edit trix-toolbar .trix-button:hover:not(:disabled) {
  background: rgb(0 0 0 / 0.08);
}

/* Icon buttons — compact, icon-only */
.reviews-section trix-toolbar .trix-button--icon,
.profile-container trix-toolbar .trix-button--icon,
.owned-edit trix-toolbar .trix-button--icon {
  width: 1.65rem;
  height: 1.65rem;
  max-width: none;
}

.reviews-section trix-toolbar .trix-button--icon::before,
.profile-container trix-toolbar .trix-button--icon::before,
.owned-edit trix-toolbar .trix-button--icon::before {
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  opacity: 0.6;
  background-size: 14px 14px;
}

.reviews-section trix-toolbar .trix-button--icon.trix-active::before,
.profile-container trix-toolbar .trix-button--icon.trix-active::before,
.owned-edit trix-toolbar .trix-button--icon.trix-active::before {
  opacity: 1;
}

/* Tone down heading size inside review Trix editors */
.reviews-section trix-editor h1,
.profile-container trix-editor h1,
.owned-edit trix-editor h1 {
  font-size: 1.125rem;
  line-height: 1.3;
}

/* Hide non-essential toolbar buttons in review forms. Keep only:
   bold, italic, strikethrough, link, bullets, numbers */
.reviews-section trix-toolbar .trix-button--icon-attach,
.reviews-section trix-toolbar .trix-button--icon-code,
.reviews-section trix-toolbar .trix-button--icon-quote,
.reviews-section trix-toolbar .trix-button--icon-heading-1,
.reviews-section trix-toolbar .trix-button--icon-decrease-nesting-level,
.reviews-section trix-toolbar .trix-button--icon-increase-nesting-level,
.reviews-section trix-toolbar .trix-button--icon-undo,
.reviews-section trix-toolbar .trix-button--icon-redo,
.profile-container trix-toolbar .trix-button--icon-attach,
.profile-container trix-toolbar .trix-button--icon-code,
.profile-container trix-toolbar .trix-button--icon-quote,
.profile-container trix-toolbar .trix-button--icon-heading-1,
.profile-container trix-toolbar .trix-button--icon-decrease-nesting-level,
.profile-container trix-toolbar .trix-button--icon-increase-nesting-level,
.profile-container trix-toolbar .trix-button--icon-undo,
.profile-container trix-toolbar .trix-button--icon-redo,
.owned-edit trix-toolbar .trix-button--icon-attach,
.owned-edit trix-toolbar .trix-button--icon-code,
.owned-edit trix-toolbar .trix-button--icon-quote,
.owned-edit trix-toolbar .trix-button--icon-heading-1,
.owned-edit trix-toolbar .trix-button--icon-decrease-nesting-level,
.owned-edit trix-toolbar .trix-button--icon-increase-nesting-level,
.owned-edit trix-toolbar .trix-button--icon-undo,
.owned-edit trix-toolbar .trix-button--icon-redo {
  display: none;
}

/* Trix dialog link — match portal inputs */
.reviews-section trix-toolbar .trix-dialog,
.profile-container trix-toolbar .trix-dialog,
.owned-edit trix-toolbar .trix-dialog {
  background: rgb(255 255 255 / 0.95);
  border: 1px solid rgb(0 0 0 / 0.15);
  border-radius: var(--radius-2, 0.75rem);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.15);
  border-top: none;
  padding: 0.75rem;
}

.reviews-section trix-toolbar .trix-input--dialog,
.profile-container trix-toolbar .trix-input--dialog,
.owned-edit trix-toolbar .trix-input--dialog {
  border-radius: var(--radius-2, 0.75rem);
  border: 1px solid rgb(0 0 0 / 0.15);
  padding: 0.45rem 0.65rem;
}
