/*
 * The CS chat panel (src/CsChat.php, assets/js/cs-chat.js), 21 Oct 2026. Same
 * Premiere-style greys as the site, the Momen crimson for the coach's own
 * messages and the main action, pink for links. Self-contained: its own
 * colours, so it looks the same on the landing page and in the account.
 */
.mm-cschat, .cs-float--chat {
    --cs-bg: #1e1e21;
    --cs-panel: #232326;
    --cs-surface: #2e2e33;
    --cs-raised: #37373d;
    --cs-line: #3a3a40;
    --cs-line2: #4a4a51;
    --cs-ink: #f2f2f4;
    --cs-ink2: #adadb6;
    --cs-ink3: #82828b;
    --cs-red: #d71149;
    --cs-red2: #ff2e63;
    --cs-pink: #ff8fa6;
    --cs-ok: #3ed37c;
}

/* ---- The floating button (the markup of .cs-float, as a button) ---- */
.cs-float.cs-float--chat {
    margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cs-float.cs-float--chat .cs-float-btn {
    position: relative; color: #fff;
    background: linear-gradient(140deg, var(--cs-red2) 0%, var(--cs-red) 58%, #a90d3a 100%);
    box-shadow: 0 8px 22px -6px rgba(215, 17, 73, .7), 0 2px 6px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.cs-float.cs-float--chat:hover .cs-float-btn,
.cs-float.cs-float--chat:focus-visible .cs-float-btn {
    box-shadow: 0 12px 28px -6px rgba(215, 17, 73, .8), 0 3px 8px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.cs-float--chat .mm-cs-ico { position: absolute; top: 50%; left: 50%; margin: -13px 0 0 -13px; transition: opacity .2s ease, transform .25s ease; }
.cs-float--chat .mm-cs-ico-x { margin: -12px 0 0 -12px; opacity: 0; transform: rotate(-90deg) scale(.6); }
html.mm-cschat-open .cs-float--chat .mm-cs-ico-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
html.mm-cschat-open .cs-float--chat .mm-cs-ico-x { opacity: 1; transform: none; }
html.mm-cschat-open .cs-float--chat .cs-float-tip,
html.mm-cschat-open .cs-hello { display: none !important; }
.cs-float--chat.cs-float--pulse .cs-float-btn::after { border-color: var(--cs-red2); }
@media (max-width: 575.98px) {
    .cs-float--chat .mm-cs-ico-chat { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
}

/* Unread counter, put in every [data-cs-badge] by the script. */
.mm-cschat-badge {
    position: absolute; top: -4px; right: -4px; z-index: 1;
    min-width: 21px; height: 21px; padding: 0 6px; border: 2px solid #1e1e21; border-radius: 11px; box-sizing: border-box;
    background: #fff; color: #c20f42; font: 800 11px/17px Inter, "Segoe UI", system-ui, sans-serif; text-align: center;
    pointer-events: none; animation: mmCsPop .35s cubic-bezier(.2, .9, .3, 1.4) both;
}
/* In the dashboard's side menu: a pill at the end of the row. */
.db-nav-item .mm-cschat-badge {
    position: static; margin-left: auto; border: 0; height: 19px; min-width: 19px; line-height: 19px; padding: 0 6px;
    background: var(--red, #d71149); color: #fff;
}
@keyframes mmCsPop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---- Panel ---- */
.mm-cschat {
    position: fixed; z-index: 70; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; width: 384px; height: 580px; max-height: calc(100vh - 110px); overflow: hidden;
    border: 1px solid var(--cs-line2); border-radius: 18px; background: var(--cs-panel); color: var(--cs-ink);
    font: 14px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; text-align: left;
    -webkit-font-smoothing: antialiased; color-scheme: dark;
    box-shadow: 0 30px 70px -12px rgba(0, 0, 0, .75), 0 0 0 1px rgba(0, 0, 0, .35), 0 12px 40px -18px rgba(215, 17, 73, .35);
    opacity: 0; transform: translateY(16px) scale(.97); transform-origin: 100% 100%;
    transition: opacity .22s ease, transform .28s cubic-bezier(.2, .9, .3, 1.1);
}
.mm-cschat[hidden] { display: none; }
.mm-cschat *, .mm-cschat *::before, .mm-cschat *::after { box-sizing: border-box; }
.mm-cschat.is-on { opacity: 1; transform: none; }
/* No floating button under it. */
.mm-cschat--low { bottom: calc(16px + env(safe-area-inset-bottom)); max-height: calc(100vh - 32px); }

.mm-cschat-head {
    position: relative; flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px;
    background:
        radial-gradient(420px 160px at 0 -60px, rgba(215, 17, 73, .32), transparent 70%),
        linear-gradient(180deg, #2b2b30, #26262a);
    border-bottom: 1px solid var(--cs-line);
}
/* A thin crimson line along the bottom, like the app's playhead. */
.mm-cschat-head::after {
    content: ""; position: absolute; left: 0; bottom: -1px; width: 38%; height: 2px;
    background: linear-gradient(90deg, var(--cs-red2), rgba(215, 17, 73, 0));
}
.mm-cschat-avatar {
    position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
    background: #17171a; border: 1px solid var(--cs-line2); box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.mm-cschat-avatar img { display: block; width: 26px; height: 26px; }
.mm-cschat-avatar::after {
    content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--cs-ok); border: 2.5px solid #29292e;
}
.mm-cschat-titles { flex: 1; min-width: 0; }
.mm-cschat-title { margin: 0; color: var(--cs-ink); font-size: 16px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.mm-cschat-sub { margin: 2px 0 0; color: var(--cs-ink2); font-size: 12px; line-height: 1.3; }
.mm-cschat-close {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; cursor: pointer;
    border: 1px solid transparent; background: transparent; color: var(--cs-ink2);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.mm-cschat-close:hover { background: var(--cs-surface); border-color: var(--cs-line); color: var(--cs-ink); }
.mm-cschat-close:focus-visible { outline: 2px solid var(--cs-red2); outline-offset: 1px; }

.mm-cschat-body {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 16px 14px 12px; background: var(--cs-bg);
    scrollbar-width: thin; scrollbar-color: var(--cs-line2) transparent;
}
.mm-cschat-body::-webkit-scrollbar { width: 6px; }
.mm-cschat-body::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--cs-line2); }
.mm-cschat-body::-webkit-scrollbar-track { background: transparent; }

.mm-cschat-row { display: flex; flex-direction: column; align-items: flex-start; margin-top: 12px; }
.mm-cschat-row:first-child { margin-top: 0; }
.mm-cschat-row--me { align-items: flex-end; }
.mm-cschat-row--cont { margin-top: 3px; }
.mm-cschat-bubble {
    max-width: 85%; padding: 9px 13px; border: 1px solid var(--cs-line); border-radius: 16px 16px 16px 5px;
    background: var(--cs-surface); color: var(--cs-ink); font-size: 14px; line-height: 1.5;
    overflow-wrap: break-word; word-wrap: break-word;
}
.mm-cschat-row--new .mm-cschat-bubble, .mm-cschat-intro .mm-cschat-bubble, .mm-cschat-typing .mm-cschat-bubble { animation: mmCsIn .22s ease-out both; }
.mm-cschat-row--me .mm-cschat-bubble {
    border-color: transparent; border-radius: 16px 16px 5px 16px; color: #fff;
    background: linear-gradient(140deg, #e8245b 0%, var(--cs-red) 60%, #b80e3e 100%);
    box-shadow: 0 6px 16px -8px rgba(215, 17, 73, .8);
}
.mm-cschat-row--pending .mm-cschat-bubble { opacity: .65; }
.mm-cschat-row--failed .mm-cschat-bubble { opacity: .8; box-shadow: 0 0 0 2px rgba(240, 84, 106, .45); }
.mm-cschat-bubble a { color: var(--cs-pink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.mm-cschat-bubble a:hover { color: #ffb3c2; }
.mm-cschat-row--me .mm-cschat-bubble a { color: #fff; }
.mm-cschat-bubble strong { font-weight: 700; color: #fff; }
.mm-cschat-meta { margin: 4px 4px 0; color: var(--cs-ink3); font-size: 11px; line-height: 1.3; }
.mm-cschat-fail { max-width: 85%; margin: 6px 2px 0; color: #f0546a; font-size: 12px; line-height: 1.4; text-align: right; }
.mm-cschat-retry {
    margin-left: 4px; padding: 0; border: 0; background: none; color: var(--cs-ink); font: inherit; font-weight: 700;
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.mm-cschat-retry:hover { color: var(--cs-pink); }
.mm-cschat-day { margin: 16px 0 4px; text-align: center; }
.mm-cschat-day span {
    display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--cs-line);
    background: var(--cs-panel); color: var(--cs-ink2); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}

.mm-cschat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 0; }
.mm-cschat-chip {
    padding: 7px 13px; border: 1px solid rgba(255, 46, 99, .42); border-radius: 999px; cursor: pointer;
    background: rgba(215, 17, 73, .1); color: var(--cs-pink); font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.mm-cschat-chip:hover, .mm-cschat-chip:focus-visible { border-color: var(--cs-red); background: var(--cs-red); color: #fff; outline: 0; }
.mm-cschat-chip:active { transform: scale(.97); }
.mm-cschat-chip[disabled] { opacity: .5; cursor: default; }

.mm-cschat-typing { display: none; margin-top: 12px; }
.mm-cschat-typing.is-on { display: block; }
.mm-cschat-typing .mm-cschat-bubble { display: inline-block; padding: 12px 14px; }
.mm-cschat-typing i {
    display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--cs-ink2);
    animation: mmCsDot 1.2s infinite ease-in-out;
}
.mm-cschat-typing i:nth-child(2) { animation-delay: .15s; }
.mm-cschat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mmCsDot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes mmCsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.mm-cschat-foot { flex: none; border-top: 1px solid var(--cs-line); background: var(--cs-panel); }
.mm-cschat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 10px 6px 12px; }
.mm-cschat-input {
    display: block; flex: 1; min-width: 0; height: 42px; max-height: 120px; margin: 0; padding: 10px 15px;
    border: 1px solid var(--cs-line2); border-radius: 21px; background: var(--cs-bg); color: var(--cs-ink);
    font: inherit; font-size: 14px; line-height: 20px; resize: none; overflow-y: auto; box-shadow: none; -webkit-appearance: none;
    scrollbar-width: thin; scrollbar-color: var(--cs-line2) transparent;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mm-cschat-input:focus { border-color: rgba(255, 46, 99, .6); outline: 0; box-shadow: 0 0 0 3px rgba(215, 17, 73, .18); }
.mm-cschat-input::placeholder { color: var(--cs-ink3); }
.mm-cschat-send {
    flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: linear-gradient(140deg, var(--cs-red2) 0%, var(--cs-red) 60%, #a90d3a 100%); color: #fff;
    box-shadow: 0 6px 16px -6px rgba(215, 17, 73, .8);
    transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}
.mm-cschat-send:hover { transform: scale(1.05); }
.mm-cschat-send:focus-visible { outline: 2px solid var(--cs-red2); outline-offset: 2px; }
.mm-cschat-send[disabled] { background: var(--cs-surface); color: var(--cs-ink3); box-shadow: none; cursor: default; transform: none; }
.mm-cschat-send svg { transform: translateX(1px); }
.mm-cschat-note {
    margin: 0; padding: 0 14px 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
    color: var(--cs-ink3); font-size: 11px; line-height: 1.35; text-align: center;
}
.mm-cschat-note svg { margin-right: 5px; vertical-align: -1px; }
.mm-cschat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Phones: a full-screen sheet. */
@media (max-width: 480px) {
    .mm-cschat, .mm-cschat--low {
        top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto; max-height: none;
        border: 0; border-radius: 0; transform: translateY(24px);
    }
    .mm-cschat-head { padding-top: calc(12px + env(safe-area-inset-top)); }
    .mm-cschat-bubble { max-width: 88%; }
    /* iOS zooms into inputs under 16px. */
    .mm-cschat-input { font-size: 16px; }
    html.mm-cschat-lock, html.mm-cschat-lock body { overflow: hidden !important; }
}
@media (prefers-reduced-motion: reduce) {
    .mm-cschat, .mm-cschat-bubble, .mm-cschat-badge, .cs-float--chat .mm-cs-ico { transition: opacity .15s ease; animation: none; }
    .mm-cschat-typing i { animation-duration: 2.4s; }
}
@media print { .mm-cschat, .cs-float--chat { display: none !important; } }

/* The landing page's first-visit greeting (cs-hello.js) and the dashboard, with the chat. */
.cs-hello .cs-hello-msg:hover { color: #c20f42; }
.cs-hello .cs-hello-msg:focus-visible, .cs-hello .cs-hello-x:focus-visible { outline-color: #d71149; }
.db .db-main { padding-bottom: 104px; }
