/* Trix Editor Styles for JRP Rich Text Editor */

.trix-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.trix-content ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.trix-content li {
    margin-bottom: 0.5rem;
    display: list-item;
}

.trix-content ul li,
.trix-content ol li {
    list-style-position: outside;
}

/* Ensure Trix editor shows list styles */
trix-editor ul {
    list-style-type: disc !important;
    padding-left: 1.5rem !important;
    margin-left: 0 !important;
}

trix-editor ol {
    list-style-type: decimal !important;
    padding-left: 1.5rem !important;
    margin-left: 0 !important;
}

trix-editor li {
    display: list-item !important;
    list-style-position: outside !important;
}

/* Alignment helper tags for Trix */
centered-div,
left-aligned-div,
right-aligned-div {
    display: block;
}

centered-div {
    text-align: center;
}

left-aligned-div {
    text-align: left;
}

right-aligned-div {
    text-align: right;
}

.trix-content centered-div,
.trix-content left-aligned-div,
.trix-content right-aligned-div {
    display: block;
}

trix-editor centered-div,
trix-editor left-aligned-div,
trix-editor right-aligned-div {
    display: block;
}

/* Ensure H1 is bigger than H2 in Trix editor */
trix-editor h1,
.trix-content h1 {
    font-size: 1.5em !important;
    font-weight: bold !important;
    line-height: 1.2 !important;
    margin-top: 0.67em !important;
    margin-bottom: 0.67em !important;
}

trix-editor h2,
.trix-content h2 {
    font-size: 1em !important;
    font-weight: bold !important;
    line-height: 1.3 !important;
    margin-top: 0.83em !important;
    margin-bottom: 0.83em !important;
}

/* Remove margin-bottom from toolbar */
trix-toolbar,
.trix-toolbar,
.trix-button-row {
    margin-bottom: 0 !important;
    padding-bottom: 3px !important;
}

/* Remove margin-bottom from all spans inside trix-button-row */
.trix-button-row > span {
    margin-bottom: 0 !important;
}

/* Remove margin-bottom and borders from heading dropdown wrapper div */
.trix-button-group[data-trix-heading-dropdown] {
    margin-bottom: 0 !important;
    border-bottom-width: 0px !important;
    border-right-width: 0px !important;
    border-top-width: 0px !important;
    border-left-width: 0px !important;
}

/* Make all Trix buttons match the Bold button dimensions */
.trix-button-group .trix-button {
    width: 33px !important;
    height: 31px !important;
    padding-right: 0px !important;
    padding-left: 0px !important;
    border-bottom-width: 0px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure heading dropdown button maintains borders when active/dropdown is open */
.trix-button-group[data-trix-heading-dropdown] .trix-button {
    border-top-width: 1px !important;
    border-left-width: 1px !important;
    border-right-width: 1px !important;
    border-bottom-width: 0px !important;
}

/* Preserve Trix's default active state borders (yellow highlight) - don't override border colors */
.trix-button-group[data-trix-heading-dropdown] .trix-button:active,
.trix-button-group[data-trix-heading-dropdown] .trix-button:focus,
.trix-button-group[data-trix-heading-dropdown] .trix-button.trix-active,
.trix-button-group[data-trix-heading-dropdown] .trix-button:hover {
    border-top-width: 1px !important;
    border-left-width: 1px !important;
    border-right-width: 1px !important;
    border-bottom-width: 0px !important;
    /* Let Trix's default active state border colors (yellow) show through */
}

.trix-button-group .trix-button .icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    line-height: 1 !important;
}

/* Trix default SVG icons */
.trix-button-group .trix-button .icon svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    display: block !important;
}

/* FontAwesome icons (color buttons) */
.trix-button-group .trix-button .icon i {
    font-size: 1.25rem !important;
    line-height: 1 !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Heading dropdown button text */
.trix-button-group .trix-button .icon span[data-heading-text] {
    font-size: 1rem !important;
    line-height: 1.25rem !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

/* Heading dropdown arrow */
.trix-button-group .trix-button .icon span:not([data-heading-text]) {
    font-size: 0.5rem !important;
    line-height: 1 !important;
}

trix-editor a,
.trix-input-wrapper .trix-content a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: #2563eb;
    font-weight: 600;
    transition: color 0.15s ease-in-out;
}

trix-editor a:hover,
.trix-input-wrapper .trix-content a:hover {
    color: #1d4ed8;
    text-decoration-color: #1d4ed8;
}

/* Attachment styling inside Trix editor */
trix-editor figure.attachment,
.trix-input-wrapper .trix-content figure.attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.5rem 0;
    min-width: 0;
}

trix-editor figure.attachment:hover,
.trix-input-wrapper .trix-content figure.attachment:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
}

trix-editor figure.attachment::before,
.trix-input-wrapper .trix-content figure.attachment::before {
    content: "📎";
    font-size: 1.25rem;
    margin-right: 0.25rem;
}

trix-editor figure.attachment figcaption,
.trix-input-wrapper .trix-content figure.attachment figcaption {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

trix-editor figure.attachment .attachment__name,
.trix-input-wrapper .trix-content figure.attachment .attachment__name {
    font-weight: 600;
    color: #1f2937;
    display: block;
    word-break: break-word;
}

trix-editor figure.attachment .attachment__size,
.trix-input-wrapper .trix-content figure.attachment .attachment__size {
    font-size: 0.85rem;
    color: #6b7280;
}

trix-editor figure.attachment.attachment--preview::before,
.trix-input-wrapper .trix-content figure.attachment.attachment--preview::before {
    content: none;
}

