/* =========================================================================
   Notes: the editor (RichNoteEditor), rendered notes (trainer and member app).
   Tokens from app.css.
   ========================================================================= */

/* ---- Rendered note text (BodyHtml) and the editor content share the typography ---- */

.tbm-note-body,
.tbm-rich-editor__content {
    font-size: 1.15rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.tbm-note-body > :first-child,
.tbm-rich-editor__content > :first-child {
    margin-top: 0;
}

.tbm-note-body > :last-child,
.tbm-rich-editor__content > :last-child {
    margin-bottom: 0;
}

.tbm-note-body p,
.tbm-rich-editor__content p {
    margin: 0 0 0.45em;
}

.tbm-note-body ul,
.tbm-note-body ol,
.tbm-rich-editor__content ul,
.tbm-rich-editor__content ol {
    margin: 0 0 0.45em;
    padding-left: 1.4em;
}

.tbm-note-body ul,
.tbm-rich-editor__content ul {
    list-style: disc;
}

.tbm-note-body ol,
.tbm-rich-editor__content ol {
    list-style: decimal;
}

.tbm-note-body ul ul,
.tbm-rich-editor__content ul ul {
    list-style: circle;
}

.tbm-note-body li > p,
.tbm-rich-editor__content li > p {
    margin: 0;
}

.tbm-note-body h3,
.tbm-rich-editor__content h3 {
    margin: 0.4em 0 0.2em;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tbm-note-body a,
.tbm-rich-editor__content a {
    color: var(--tbm-pink-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tbm-note-body del,
.tbm-rich-editor__content s {
    color: var(--tbm-text-secondary);
}

/* ---- Editor ---------------------------------------------------------------- */

.tbm-rich-editor {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-panel);
    transition: border-color 0.15s;
}

.tbm-rich-editor:focus-within {
    border-color: var(--tbm-pink);
}

.tbm-rich-editor--over,
.tbm-rich-editor--over:focus-within {
    border-color: var(--tbm-error);
}

.tbm-rich-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-bottom: 1px solid var(--tbm-border);
}

.tbm-rich-editor__tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--tbm-radius);
    background: transparent;
    color: var(--tbm-text-secondary);
    cursor: pointer;
}

.tbm-rich-editor__tool .mud-icon-root {
    font-size: 1.2rem;
}

.tbm-rich-editor__tool:hover:not(:disabled) {
    background: rgba(var(--tbm-overlay), 0.06);
    color: var(--tbm-text);
}

.tbm-rich-editor__tool:focus-visible {
    outline: 2px solid var(--tbm-pink);
    outline-offset: -2px;
}

.tbm-rich-editor__tool--active {
    background: rgba(231, 50, 114, 0.18);
    color: var(--tbm-pink-accent);
}

.tbm-rich-editor__tool:disabled {
    opacity: 0.4;
    cursor: default;
}

.tbm-rich-editor__divider {
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: var(--tbm-border-strong);
}

.tbm-rich-editor__surface {
    min-height: 110px;
    max-height: 360px;
    overflow-y: auto;
    padding: 10px 14px;
    cursor: text;
}

.tbm-rich-editor__content {
    min-height: 90px;
    outline: none;
    color: var(--tbm-text);
    white-space: pre-wrap;
}

.tbm-rich-editor__content p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    color: var(--tbm-text-secondary);
    pointer-events: none;
}

.tbm-rich-editor__loading {
    margin: 0;
    color: var(--tbm-text-secondary);
    font-size: 1.15rem;
    white-space: pre-wrap;
}

.tbm-rich-editor__fallback {
    min-height: 130px;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--tbm-radius);
    background: transparent;
    color: var(--tbm-text);
    font-size: 1.15rem;
    resize: vertical;
    outline: none;
}

.tbm-rich-editor__counter {
    margin: 0;
    padding: 0 12px 6px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
    text-align: right;
}

.tbm-rich-editor--over .tbm-rich-editor__counter {
    color: var(--tbm-error);
    font-weight: 700;
}

.tbm-rich-editor__link-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbm-rich-editor .tbm-popover__panel {
    top: calc(100% + 4px);
}

/* ---- Emoji picker ------------------------------------------------------- */

.tbm-emoji-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbm-emoji-picker__search {
    min-height: 40px;
    font-size: 1.1rem;
}

.tbm-emoji-picker__grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
}

.tbm-emoji-picker__emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--tbm-radius);
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.tbm-emoji-picker__emoji:hover,
.tbm-emoji-picker__emoji:focus-visible {
    background: rgba(var(--tbm-overlay), 0.1);
    outline: none;
}

.tbm-emoji-picker__empty {
    margin: 0;
    font-size: 1rem;
}

/* ---- Composer (dialog and inline) ----------------------------------------- */

.tbm-note-composer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tbm-note-composer__collapsed {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-panel);
    color: var(--tbm-text-secondary);
    font-family: var(--tbm-font);
    font-size: 1.2rem;
    text-align: left;
    cursor: text;
}

.tbm-note-composer__collapsed:hover,
.tbm-note-composer__collapsed:focus-visible {
    border-color: var(--tbm-pink);
    outline: none;
}

.tbm-note-composer__draft {
    margin: 0;
    color: var(--tbm-text-secondary);
    font-size: 1rem;
}

.tbm-note-composer__options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 24px;
}

.tbm-note-composer__visibility {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tbm-note-composer__help {
    padding-left: 54px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
}

.tbm-note-composer__duo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
}

.tbm-note-composer__duo input {
    width: 20px;
    height: 20px;
    accent-color: var(--tbm-pink);
}

.tbm-note-composer__errors p {
    margin: 0;
}

.tbm-note-composer__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

/* Switch: "Zichtbaar voor lid" */
.tbm-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 36px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
}

.tbm-switch__track {
    position: relative;
    flex: none;
    width: 42px;
    height: 24px;
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-input-raised);
    border: 1px solid var(--tbm-border-strong);
    transition: background 0.15s;
}

.tbm-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--tbm-text-secondary);
    transition: transform 0.15s, background 0.15s;
}

.tbm-switch[aria-checked="true"] .tbm-switch__track {
    background: var(--tbm-blue-bg);
    border-color: var(--tbm-carbs);
}

.tbm-switch[aria-checked="true"] .tbm-switch__thumb {
    transform: translateX(18px);
    background: var(--tbm-carbs);
}

.tbm-switch:focus-visible .tbm-switch__track {
    outline: 2px solid var(--tbm-pink);
    outline-offset: 2px;
}

.tbm-switch:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Confirmation before a note becomes visible to the member */
.tbm-note-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 14px;
    border: 1px solid rgba(34, 211, 255, 0.4);
    border-radius: var(--tbm-radius);
    background: var(--tbm-blue-bg);
}

.tbm-note-confirm p {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.tbm-note-confirm__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tbm-note-confirm__actions .tbm-btn-primary--compact {
    min-height: 36px;
    padding: 0 18px;
    font-size: 1rem;
}

.tbm-note-confirm--warning {
    border-color: rgba(252, 211, 77, 0.45);
    background: var(--tbm-warning-bg);
}

/* Dialog of ±640 px */
.tbm-note-dialog.mud-dialog {
    width: min(640px, calc(100vw - 32px));
    max-width: none;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-card);
    color: var(--tbm-text);
}

.tbm-note-dialog .mud-dialog-title {
    padding: 22px 24px 6px;
}

.tbm-note-dialog__title {
    font-size: 1.8rem;
}

.tbm-note-dialog__content.mud-dialog-content {
    padding: 8px 24px 22px;
    overflow: visible;
}

/* ---- Notes card (Overzicht) and timeline items ---------------------------- */

.tbm-note-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tbm-note-item {
    padding: 14px 18px 16px;
    border-radius: var(--tbm-radius);
    background: var(--tbm-input);
}

.tbm-note-item__meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
}

.tbm-note-item__by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tbm-note-item__pin.mud-icon-root {
    width: 16px;
    height: 16px;
    color: var(--tbm-pink-accent);
}

.tbm-note-visibility {
    flex: none;
    color: var(--tbm-text);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}

.tbm-note-visibility--member {
    color: var(--tbm-carbs);
}

.tbm-note-item__text--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    overflow: hidden;
}

.tbm-note-item__more {
    margin-top: 6px;
    font-size: 1.05rem;
}

.tbm-notes-card__all {
    display: inline-block;
    margin-top: 16px;
}

.tbm-notes-card__add {
    margin-top: 10px;
}

/* ---- Tab Notities ---------------------------------------------------------- */

.tbm-notes-tab {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 920px;
}

.tbm-notes-tab__composer {
    padding: 18px 20px;
    border: 1px solid var(--tbm-border);
    border-radius: var(--tbm-radius);
    background: var(--tbm-card);
}

.tbm-notes-tab__filters {
    margin-bottom: 0;
}

.tbm-notes-tab__more {
    display: flex;
    justify-content: center;
    padding: 4px 0 12px;
}

.tbm-timeline {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.tbm-timeline__month-title {
    margin: 0 0 10px;
    color: var(--tbm-text-secondary);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tbm-timeline__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tbm-timeline__item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.tbm-timeline__avatar {
    margin-top: 14px;
}

.tbm-timeline__card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px 16px;
    border: 1px solid var(--tbm-border);
    border-radius: var(--tbm-radius);
    background: var(--tbm-card);
}

.tbm-timeline__item--pinned .tbm-timeline__card {
    border-color: rgba(231, 50, 114, 0.45);
}

.tbm-timeline__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
}

.tbm-timeline__who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    font-size: 1.1rem;
}

.tbm-timeline__pinned {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--tbm-pink-accent);
    font-weight: 600;
    font-size: 1rem;
}

.tbm-timeline__pinned .mud-icon-root {
    width: 15px;
    height: 15px;
}

.tbm-timeline__labels {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tbm-timeline__category {
    min-height: 26px;
    padding: 0 10px;
    font-size: 0.98rem;
}

.tbm-timeline__menu.tbm-round-btn {
    width: 34px;
    height: 34px;
}

.tbm-timeline__menu .mud-icon-root {
    font-size: 1.25rem;
}

.tbm-timeline__read {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--tbm-text-secondary);
    font-size: 1rem;
}

.tbm-timeline__read--done {
    color: var(--tbm-carbs);
}

.tbm-timeline__read .mud-icon-root {
    width: 16px;
    height: 16px;
}

.tbm-timeline__edit {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tbm-note-menu .mud-menu-item {
    font-family: var(--tbm-font);
    font-size: 1.1rem;
}

/* History side panel (beheer) */
.tbm-note-history__list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tbm-note-history__item {
    padding: 12px 14px;
    border-radius: var(--tbm-radius);
    background: var(--tbm-input);
}

.tbm-note-history__meta,
.tbm-note-history__labels {
    margin: 0 0 4px;
    font-size: 1rem;
}

.tbm-note-history__labels {
    margin-bottom: 8px;
    color: var(--tbm-text-secondary);
}

@media (max-width: 767.98px) {
    .tbm-timeline__item {
        grid-template-columns: minmax(0, 1fr);
    }

    .tbm-timeline__avatar {
        display: none;
    }
}

/* ---- Member app: bell, Berichten, latest note under the progress chart ----- */

.tbm-notes-bell {
    position: relative;
    text-decoration: none;
}

.tbm-notes-bell__badge {
    position: absolute;
    top: -1px;
    right: -1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--tbm-bg);
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-pink);
    color: var(--tbm-on-pink);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

.tbm-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px var(--tbm-gutter) 28px;
}

/* Berichten as a pop-up: the dialog gives the padding, the list scrolls inside it */
.tbm-messages--dialog {
    padding: 0 0 8px;
}

.tbm-messages-dialog__title {
    margin: 0;
    padding-right: 32px;
    font-size: 1.8rem;
}

.tbm-messages__title {
    font-size: 2.3rem;
}

.tbm-messages__accent {
    color: var(--tbm-pink);
}

.tbm-messages__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tbm-messages__more {
    align-self: center;
}

.tbm-messages__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 32px 16px;
    border: 1px dashed var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    color: var(--tbm-text-secondary);
    text-align: center;
    font-size: 1.15rem;
}

.tbm-messages__empty p {
    margin: 0;
}

.tbm-messages__empty strong {
    color: var(--tbm-text);
}

.tbm-messages__empty .mud-icon-root {
    font-size: 2rem;
}

.tbm-messages__footer {
    margin: 8px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 1.1rem;
    text-align: center;
}

/* Quote style of the design: pink tint, the text, "– trainer · date" in the secondary colour */
.tbm-note-quote {
    position: relative;
    margin: 0;
    padding: 14px 16px 12px;
    border-radius: var(--tbm-radius);
    background: rgba(231, 50, 114, 0.14);
}

.tbm-note-quote__text {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

.tbm-note-quote--unread .tbm-note-quote__text {
    padding-right: 16px;
}

.tbm-note-quote__by {
    margin-top: 6px;
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
}

.tbm-note-quote__dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tbm-pink);
}
