/* Styles for the single-message view modal and the super-admin compose modal.
   (Shared message-list row styles live in css/control/notification_bell.css.) */

/* ---- View a single message ---- */
/* A comfortable, consistent reading width so short messages don't render as a tiny box
   (the modal is fit-content, so the content width drives the modal width). */
.msg-view {
    padding: 4px 6px 10px;
    width: min(520px, 86vw);
    max-width: 100%;
}

.msg-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    color: #7a7a7a;
    font-size: 12.5px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.msg-view-meta strong {
    color: #444;
}

.msg-view-body {
    font-size: 14.5px;
    line-height: 1.6;
    color: #2b2b2b;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.msg-view-body p {
    margin: 0 0 10px;
}

.msg-view-body ul,
.msg-view-body ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.msg-view-body a {
    color: #007e82;
    text-decoration: underline;
}

.msg-view-body blockquote {
    margin: 0 0 10px;
    padding: 6px 14px;
    border-left: 3px solid #009fa4;
    background: rgba(0, 159, 164, 0.06);
    color: #444;
}

.msg-view-loading {
    padding: 30px;
    text-align: center;
    color: #8a8a8a;
}

.msg-view-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.msg-view-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid rgba(229, 51, 47, 0.4);
    background: #ffffff;
    color: #e5332f;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.msg-view-delete:hover {
    background: #e5332f;
    color: #ffffff;
}

.msg-view-delete:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ---- Compose (super-admin) ---- */
.msg-compose {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(620px, 90vw);
    padding: 4px 4px 6px;
}

.msg-compose-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-compose-field > label {
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
}

/* "Show sender" toggle — a plain checkbox + label, so it reads as an inline option. */
.msg-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    user-select: none;
}

.msg-toggle-label input {
    width: 16px;
    height: 16px;
    accent-color: #009fa4;
    cursor: pointer;
}

.msg-compose-title-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    font-size: 14px;
}

/* Rich-text editor */
.msg-editor-toolbar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #f7f7f7;
}

.msg-editor-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
}

.msg-editor-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.msg-editor-btn.is-active {
    background: rgba(0, 159, 164, 0.15);
    border-color: rgba(0, 159, 164, 0.4);
    color: #007e82;
}

.msg-editor {
    min-height: 150px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    line-height: 1.55;
    outline: none;
    background: #fff;
}

.msg-editor:empty::before {
    content: attr(data-placeholder);
    color: #a5a5a5;
}

/* WYSIWYG parity: the editor renders blocks the same way the view modal does below. */
.msg-editor p {
    margin: 0 0 10px;
}

.msg-editor ul,
.msg-editor ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.msg-editor a {
    color: #007e82;
    text-decoration: underline;
}

/* Scope radios */
.msg-scope-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.msg-scope-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.msg-scope-option.is-active {
    border-color: #009fa4;
    background: rgba(0, 159, 164, 0.08);
    color: #007e82;
    font-weight: 600;
}

.msg-scope-option input {
    accent-color: #009fa4;
}

/* Recipient picker (user search / org select) */
.msg-recipient-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-recipient-picker.is-hidden {
    display: none;
}

.msg-recipient-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    font-size: 14px;
}

/* In-flow (not absolute) so it can't be clipped by the fit-content modal — the modal grows and
   the content area scrolls, and _ensureResultsVisible() scrolls it into view. */
.msg-recipient-results {
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    display: none;
}

.msg-recipient-results.is-open {
    display: block;
}

.msg-recipient-result {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.msg-recipient-result:hover,
.msg-recipient-result.is-highlighted {
    background: rgba(0, 159, 164, 0.1);
}

.msg-recipient-result-sub {
    font-size: 11.5px;
    color: #888;
}

.msg-recipient-selected {
    font-size: 12.5px;
    color: #007e82;
    font-weight: 600;
}

.msg-recipient-selected:empty {
    display: none;
}

/* Multi-select users: search input + chips for the chosen users. */
.msg-user-search-wrap {
    position: relative;
}

.msg-user-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.msg-user-chips:not(:empty) {
    margin-bottom: 8px;
}

.msg-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 159, 164, 0.12);
    color: #007e82;
    border: 1px solid rgba(0, 159, 164, 0.3);
    border-radius: 16px;
    padding: 3px 6px 3px 12px;
    font-size: 12.5px;
    font-weight: 600;
}

.msg-user-chip-x {
    border: 0;
    background: transparent;
    color: #007e82;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 50%;
}

.msg-user-chip-x:hover {
    color: #e5332f;
}

/* Actions */
.msg-compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.msg-compose-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.msg-compose-btn-cancel {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.2);
    color: #555;
}

.msg-compose-btn-send {
    background: linear-gradient(180deg, #009fa4 0%, #007e82 100%);
    color: #fff;
}

.msg-compose-btn-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
