/* Messages page. Uses Bulma 1.0's theme variables, so it follows light/dark mode
   (the site's .theme-dark class) instead of fixed light colours. */

.dm-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--bulma-text);
}
.dm-row:hover {
    background-color: var(--bulma-background);
    color: var(--bulma-text-strong);
}
.dm-row.is-active {
    background-color: var(--bulma-background);
    box-shadow: inset 3px 0 0 #D45F7C;
}

/* Photos are cropped to their circle, not squashed into it. */
.dm-row img,
.dm-who img {
    object-fit: cover;
    aspect-ratio: 1;
}

.dm-preview {
    color: var(--bulma-text-weak);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-thread {
    height: 55vh;
    overflow-y: auto;
    padding: 4px;
}

.dm-bubble {
    display: inline-block;
    max-width: 80%;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 14px 14px 14px 4px;
    text-align: left;
    word-break: break-word;
    background-color: var(--bulma-background);
    color: var(--bulma-text-strong);
}
.dm-bubble.is-mine {
    border-radius: 14px 14px 4px 14px;
    background-color: #D45F7C;
    color: #fff;
}
.dm-bubble.is-mine a {
    color: #fff;
    text-decoration: underline;
}

.dm-meta,
.dm-meta a {
    font-size: 0.75rem;
    color: var(--bulma-text-weak);
}
.dm-meta a:hover {
    color: var(--bulma-text-strong);
}

.dm-deleted {
    font-style: italic;
    opacity: 0.7;
}

/* Call history entries ("Missed call", "Call · 2:05"). */
.dm-call {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-style: italic;
}
.dm-call .material-symbols-outlined {
  font-size: 1.1em;
}

/* Unread count on a match card / inbox row. */
.dm-unread {
    margin-left: 0.4rem;
}

/* The inbox and the conversation are boxes as tall as the screen allows (messenger.fitPanes sets
   the height): the list and the thread scroll inside them, and the message box stays at the
   bottom, so nobody scrolls the page to type. */
.dm-pane {
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
}
.dm-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.dm-pane .dm-thread {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}
.dm-compose {
    flex: none;
}

/* Conversation header: who, then the call/mute buttons in a row (also on phones). */
.dm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex: none;
    margin-bottom: 0.5rem;
}
.dm-who {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.dm-who strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dm-actions {
    display: flex;
    flex-direction: row;
    flex: none;
    gap: 0.35rem;
}

/* Phones: the conversation tab can't be chosen until someone is picked in Chats. */
.tabs li.is-disabled a {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

/* Support cases */
.support-avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #D45F7C; color: #fff; }
.support-avatar.is-small { width: 32px; height: 32px; }
.support-avatar.is-small .material-symbols-outlined { font-size: 1.2rem; }
.case-subject { font-weight: 700; text-align: center; margin: 0.25rem 0 0.75rem; }

/* Inbox filter (All chats / New matches): two pill buttons the same height. */
.dm-filter {
    flex: none;
    display: flex;
    gap: 0.4rem;
}
.dm-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2rem;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--bulma-border);
    background: var(--bulma-scheme-main);
    color: var(--bulma-text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.dm-chip:hover {
    color: var(--bulma-text-strong);
    border-color: var(--bulma-border-hover);
}
.dm-chip.is-on {
    background: #D45F7C;
    border-color: #D45F7C;
    color: #fff;
}
.dm-chip-count {
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #D45F7C;
    color: #fff;
    font-size: 0.7rem;
    line-height: 1.15rem;
    text-align: center;
}
.dm-chip.is-on .dm-chip-count {
    background: #fff;
    color: #D45F7C;
}
.dm-avatar {
    position: relative;
}
.dm-new-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #D45F7C;
    box-shadow: 0 0 0 2px var(--bulma-scheme-main);
}
.dm-new-tag {
    font-size: 0.7rem;
    height: 1.6em;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.dm-new-tag .material-symbols-outlined {
    font-size: 0.9rem;
    margin-right: 0.15rem;
}

/* The conversation header's name and photo open their profile. */
.dm-who-link {
    color: var(--bulma-text-strong);
    cursor: pointer;
}
.dm-who-link:hover strong {
    text-decoration: underline;
}

/* A new match's empty conversation. */
.dm-intro {
    text-align: center;
    margin-top: 1.5rem;
}
.dm-intro-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

/* A match's profile page (/match/:user): one card, the photo with their name over it, round
   call / message / video buttons, then their bio. Report, block and unmatch are in the ... menu. */
.match-page {
    max-width: 440px;
    margin: 0 auto;
}
.match-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.match-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: var(--bulma-scheme-main);
    color: var(--bulma-text-strong);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
}
.match-card {
    background: var(--bulma-scheme-main);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}
.match-photo {
    position: relative;
    aspect-ratio: 4 / 5;
    max-height: 68vh;
    width: 100%;
    background: #222;
}
.match-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.match-dots {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 2;
}
.match-dots span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.4);
}
.match-dots span.is-on {
    background: #fff;
}
.match-tap {
    position: absolute;
    top: 0;
    bottom: 30%;
    width: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #fff;
}
.match-tap .material-symbols-outlined {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}
.match-photo:hover .match-tap .material-symbols-outlined {
    opacity: 1;
}
.match-tap.is-prev { left: 0; }
.match-tap.is-next { right: 0; justify-content: flex-end; }
.match-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3rem 1.1rem 2.6rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    color: #fff;
}
.match-name h1 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.match-age {
    font-weight: 400;
}
.match-name p {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}
.match-name p .material-symbols-outlined {
    font-size: 1rem;
    color: #ff8fab;
    font-variation-settings: 'FILL' 1;
}
.match-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: -1.9rem;
    position: relative;
    z-index: 3;
}
.match-round {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bulma-scheme-main);
    color: #D45F7C;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}
.match-round:hover {
    transform: translateY(-1px);
}
.match-round.is-main {
    width: 64px;
    height: 64px;
    background: #D45F7C;
    color: #fff;
}
.match-round.is-main .material-symbols-outlined {
    font-size: 1.8rem;
}
.match-about {
    padding: 1rem 1.25rem 1.4rem;
}
.match-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bulma-text-weak);
    margin-bottom: 0.35rem;
}
.match-bio {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--bulma-text-strong);
}

/* Bulma's .columns pulls itself out by a full column gap on each side, which leaves the page a
   few pixels wider than the screen on phones (a sideways scroll). Pull out a little less. */
.columns.fit-columns {
    margin-inline-end: 0;
}



/* --- who's online (presence.rs): green dots, the friends-online strip, the Appear offline switch --- */
.avatar-presence { position: relative; display: inline-flex; flex: none; }
.online-dot {
    position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
    background: #32de84; box-shadow: 0 0 0 2px var(--presence-ring, var(--bulma-scheme-main));
}
.image.is-32x32 .online-dot, .mb-avatar.is-small + .online-dot { width: 10px; height: 10px; }
.dm-active-now.is-off { visibility: hidden; } /* keeps its line, so the header never shifts */
.dm-active-now { display: block; font-size: 0.75rem; line-height: 1.1; color: #1fa463; }
.theme-dark .dm-active-now { color: #32de84; }
.dm-who > span { min-width: 0; display: flex; flex-direction: column; }

.dm-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.dm-online { height: 76px; margin-bottom: 0.5rem; border-bottom: 1px solid var(--bulma-border-weak); flex: none; }
.dm-online-person { position: absolute; top: 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; color: var(--bulma-text); font-size: 0.72rem; }
.dm-online-person img { width: 40px; height: 40px; object-fit: cover; }
.dm-online-person > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-online-person:hover { color: var(--bulma-text-strong); }

/* The online strips are virtual: the track is as wide as everyone, people are placed by index. */
.online-strip { position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; overscroll-behavior-x: contain; }
.online-strip-track { position: relative; height: 100%; min-width: 100%; }
.online-strip-empty {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 0.75rem;
    text-align: center; font-size: 0.75rem; line-height: 1.3; color: var(--bulma-text-weak); pointer-events: none;
}
.mb-online .online-strip-empty { color: var(--mb-weak); font-size: 11.5px; }

/* Bigger photos (profiles, room owner, cards): a bigger dot, tucked onto the photo's edge. */
.online-dot.is-large { width: 18px; height: 18px; right: 4%; bottom: 4%; box-shadow: 0 0 0 3px var(--presence-ring, var(--bulma-scheme-main)); }
.profile-photo-wrap { align-self: flex-end; }
.profile-photo-wrap .online-dot.is-large { width: 22px; height: 22px; right: 8px; bottom: 8px; box-shadow: 0 0 0 4px #fff; }
.theme-dark .profile-photo-wrap .online-dot.is-large { box-shadow: 0 0 0 4px #14161a; }
.room-head-presence { flex: none; }
.user-card-photo + .online-dot { right: 1px; bottom: 1px; }

.presence-switch { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--bulma-border); transition: background-color 0.15s; flex: none; }
.presence-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.presence-switch.is-on { background: #D45F7C; }
.presence-switch.is-on::after { transform: translateX(12px); }

/* --- message settings (the gear in the message bar and on Messages) --- */
.chat-settings { display: flex; flex-direction: column; gap: 2px; }
.chat-settings-title { margin: 0 0 4px; padding: 4px 8px 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bulma-text-weak); }
.chat-setting {
    display: flex; align-items: flex-start; gap: 0.65rem; width: 100%; padding: 0.55rem 0.5rem; border: 0; border-radius: 10px;
    background: none; color: var(--bulma-text); font: inherit; text-align: left; cursor: pointer;
}
.chat-setting:hover { background: var(--bulma-background); }
.chat-setting .presence-switch { margin-top: 2px; }
.chat-setting-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-setting-text strong { font-size: 0.85rem; color: var(--bulma-text-strong); }
.chat-setting-text small { font-size: 0.74rem; line-height: 1.35; color: var(--bulma-text-weak); }
.chat-settings.is-in-bar { flex: 1 0 auto; padding: 2px 0; }
.chat-settings.is-in-bar .chat-settings-title { color: var(--mb-weak); }
.chat-settings.is-in-bar .chat-setting { color: var(--mb-text); }
.chat-settings.is-in-bar .chat-setting:hover { background: var(--mb-raise); }
.chat-settings.is-in-bar .chat-setting-text strong { color: var(--mb-text); font-size: 13px; }
.chat-settings.is-in-bar .chat-setting-text small { color: var(--mb-weak); font-size: 11.5px; }
.chat-settings.is-in-bar .presence-switch:not(.is-on) { background: var(--mb-line); box-shadow: inset 0 0 0 1px var(--mb-weak); }
.chat-settings.is-in-bar .mb-all { margin-top: auto; }

/* Messages: the gear's menu floats over the page, so opening it moves nothing. */
.chat-settings-wrap { position: relative; }
.button.chat-gear, .button.chat-gear:focus, .button.chat-gear:active { color: var(--bulma-text-weak); text-decoration: none; box-shadow: none; }
.button.chat-gear:hover, .button.chat-gear.is-on { color: #D45F7C; background: var(--bulma-background); }
.chat-settings.is-popover {
    position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: min(320px, calc(100vw - 2rem)); padding: 0.4rem;
    border: 1px solid var(--bulma-border-weak); border-radius: 12px; background: var(--bulma-scheme-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* Under the thread on Messages: the same fixed-height status line. */
.dm-status {
    height: 20px; margin: 0.25rem 0 0; padding: 0 0.25rem; display: flex; align-items: center; justify-content: flex-end; gap: 4px;
    font-size: 0.75rem; color: var(--bulma-text-weak); white-space: nowrap; overflow: hidden; flex: none;
}
.dm-status.is-typing { justify-content: flex-start; color: #D45F7C; }

/* "typing" dots */
.typing-dots { display: inline-flex; gap: 2px; margin-left: 1px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: typing-dot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: 0.7; } }

/* "Who can message / call me": three fixed-width segments, so choosing never moves anything. */
.chat-choice { display: flex; flex-direction: column; gap: 5px; padding: 0.55rem 0.5rem; }
.chat-choice > strong { font-size: 0.85rem; color: var(--bulma-text-strong); }
.chat-choice > small { font-size: 0.74rem; line-height: 1.35; color: var(--bulma-text-weak); }
.chat-choice-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border-radius: 9px; background: var(--bulma-background); }
.chat-choice-options button {
    padding: 0.3rem 0.25rem; border: 0; border-radius: 7px; background: none; color: var(--bulma-text);
    font: inherit; font-size: 0.75rem; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.chat-choice-options button:hover { color: var(--bulma-text-strong); }
.chat-choice-options button.is-on { background: #D45F7C; color: #fff; }
.chat-settings.is-in-bar .chat-choice > strong { color: var(--mb-text); font-size: 13px; }
.chat-settings.is-in-bar .chat-choice > small { color: var(--mb-weak); font-size: 11.5px; }
.chat-settings.is-in-bar .chat-choice-options { background: var(--mb-raise); }
.chat-settings.is-in-bar .chat-choice-options button { color: var(--mb-text); font-size: 11.5px; }
.chat-settings.is-in-bar .chat-choice-options button.is-on { color: #fff; }

/* A match's profile: "Online" beside the name, over the photo. */
.match-online { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.6rem; font-size: 0.85rem; font-weight: 600; vertical-align: middle; }
.match-online .online-dot { position: static; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
