/* Photo + voice note on comments (public/js/gm-media.js, App\Support\CommentMedia) — theme colours, both directions
   (logical properties only, so RTL needs no mirror rules). */

/* ── Composer: 📷 beside the emoji, 🎤 in the send button's place while the box is empty (WhatsApp-style) ── */
/* the textarea is dir="auto" (its own direction follows the text), the buttons follow the page — so physical sides by page direction */
html body .gm-cbox.gm-has-tools .gm-composer textarea { padding-right: 7.1rem !important; }
html[dir=rtl] body .gm-cbox.gm-has-tools .gm-composer textarea { padding-right: 1rem !important; padding-left: 7.1rem !important; }
html body .gm-cbox.gm-has-tools .gm-composer__count { right: 7.1rem; }
html[dir=rtl] body .gm-cbox.gm-has-tools .gm-composer__count { right: auto; left: 7.1rem; }
.gm-media-btn { position: absolute; bottom: .45rem; z-index: 2; display: flex; width: 1.9rem; height: 1.9rem; align-items: center; justify-content: center;
    border-radius: 9999px; cursor: pointer; color: color-mix(in oklch, var(--color-foreground) 62%, transparent); transition: background-color .15s, color .15s, transform .15s; }
.gm-media-btn:hover { background: color-mix(in oklch, var(--color-foreground) 7%, transparent); color: var(--color-foreground); }
.gm-media-btn svg { width: 19px; height: 19px; }
.gm-media-btn--photo { inset-inline-end: 4.85rem; }
.gm-media-btn--mic { inset-inline-end: .45rem; color: var(--color-primary); display: none; }
.gm-media-btn--mic:hover { color: var(--color-primary); background: color-mix(in oklch, var(--color-primary) 10%, transparent); }
.gm-cbox.is-blank .gm-media-btn--mic { display: flex; }
.gm-cbox.is-blank .gm-cbox__send { visibility: hidden; }

/* tray: what will be sent with the text (photo thumbnail · voice note), above the box */
.gm-cform[data-media] { flex-wrap: wrap; }   /* the photo goes on its own line under the box */
.gm-media-tray { display: none; flex-basis: 100%; flex-wrap: wrap; align-items: flex-start; gap: .5rem; margin-top: .45rem; }
.gm-media-tray.is-on { display: flex; }
/* the photo as Facebook shows it under the comment box: its own shape, ~8rem tall, × in the corner */
.gm-mt-img { position: relative; flex: none; max-width: min(15rem, 100%); border-radius: .85rem; overflow: hidden;
    border: 1px solid color-mix(in oklch, var(--color-foreground) 10%, transparent); background: color-mix(in oklch, var(--color-foreground) 5%, transparent); }
.gm-mt-img img { display: block; height: 8rem; width: auto; max-width: 100%; object-fit: cover; cursor: zoom-in; }
.gm-mt-voice { position: relative; display: flex; align-items: center; padding: .3rem .55rem; padding-inline-end: 2.1rem; border-radius: 1.1rem; min-width: 0;
    background: color-mix(in oklch, var(--color-primary) 8%, transparent); border: 1px solid color-mix(in oklch, var(--color-primary) 18%, transparent); }
.gm-mt-x { position: absolute; top: .35rem; inset-inline-end: .35rem; display: flex; width: 1.6rem; height: 1.6rem; align-items: center; justify-content: center; border-radius: 9999px;
    cursor: pointer; color: #fff; background: rgb(0 0 0 / .62); transition: background-color .15s; }
.gm-mt-x:hover { background: var(--color-danger); }
.gm-mt-x svg { width: 13px; height: 13px; }
.gm-mt-voice .gm-mt-x { top: 50%; transform: translateY(-50%); inset-inline-end: .4rem; color: var(--color-foreground); background: color-mix(in oklch, var(--color-foreground) 10%, transparent); }
.gm-mt-voice .gm-mt-x:hover { color: #fff; background: var(--color-danger); }
.gm-mt-busy { font-size: 12px; opacity: .7; display: inline-flex; align-items: center; gap: .4rem; }

/* recording: the whole box becomes the recorder — cancel · ● time · live level · stop */
.gm-rec { position: absolute; inset-inline: 0; bottom: 0; z-index: 3; display: none; height: 2.75rem; align-items: center; gap: .5rem; padding: 0 .35rem;
    border-radius: 1.375rem; background: var(--color-background); border: 1px solid color-mix(in oklch, var(--color-danger) 35%, transparent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-danger) 10%, transparent); }
.gm-cbox.is-rec .gm-rec { display: flex; }
.gm-rec__btn { display: flex; flex: none; width: 2.05rem; height: 2.05rem; align-items: center; justify-content: center; border-radius: 9999px; cursor: pointer; transition: background-color .15s, transform .1s; }
.gm-rec__btn:active { transform: scale(.94); }
.gm-rec__btn svg { width: 18px; height: 18px; }
.gm-rec__cancel { color: var(--color-danger); }
.gm-rec__cancel:hover { background: color-mix(in oklch, var(--color-danger) 5%, transparent); }
.gm-rec__stop { color: var(--color-primary); border: 1px solid color-mix(in oklch, var(--color-primary) 60%, transparent); background: color-mix(in oklch, var(--color-primary) 20%, transparent); }
.gm-rec__stop:hover { background: color-mix(in oklch, var(--color-primary) 5%, transparent); }
.gm-rec__cancel { border: 1px solid color-mix(in oklch, var(--color-danger) 60%, transparent); background: color-mix(in oklch, var(--color-danger) 20%, transparent); }
.gm-rec__dot { width: .6rem; height: .6rem; flex: none; border-radius: 9999px; background: var(--color-danger); animation: gm-rec-pulse 1.1s ease-in-out infinite; }
@keyframes gm-rec-pulse { 50% { opacity: .25; transform: scale(.8); } }
.gm-rec__time { direction: ltr; unicode-bidi: isolate; flex: none; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.gm-rec__max { font-weight: 400; opacity: .5; }
.gm-rec__level { display: flex; flex: 1; min-width: 0; height: 1.6rem; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; direction: ltr; }
.gm-rec__level i { display: block; flex: none; width: 3px; border-radius: 2px; background: color-mix(in oklch, var(--color-danger) 70%, transparent); transition: height .08s; }
@media (prefers-reduced-motion: reduce) { .gm-rec__dot { animation: none; } }

/* ── In the comment: the photo under the bubble, the voice note inside it ── */
.gm-cmedia-img { display: block; margin-top: .35rem; max-width: min(17.5rem, 100%); max-height: 20rem; width: auto; height: auto; border-radius: 1rem; cursor: zoom-in;
    object-fit: cover; border: 1px solid color-mix(in oklch, var(--color-foreground) 8%, transparent); background: color-mix(in oklch, var(--color-foreground) 5%, transparent); }
.gm-bubble .gm-voice { margin-top: .3rem; }

/* voice player: ▶ · waveform (tap / drag to seek) · time · speed */
/* media controls are never mirrored (Material / WhatsApp): ▶ and the progress run left → right in Arabic too */
.gm-voice { direction: ltr; display: flex; align-items: center; gap: .6rem; width: 17rem; max-width: 100%; min-width: 0; user-select: none; -webkit-user-select: none; }
/* Midone rounded button (enigma-side-menu-button.html): the colour at 20% inside, 60% border, coloured icon */
.gm-voice__play { display: flex; flex: none; width: 2.25rem; height: 2.25rem; align-items: center; justify-content: center; border-radius: 9999px; cursor: pointer;
    color: var(--color-primary); border: 1px solid color-mix(in oklch, var(--color-primary) 60%, transparent); background: color-mix(in oklch, var(--color-primary) 20%, transparent);
    transition: transform .1s, background-color .15s; }
.gm-voice__play:hover { background: color-mix(in oklch, var(--color-primary) 5%, transparent); }
.gm-voice__play:active { transform: scale(.93); }
.gm-voice__play svg { width: 16px; height: 16px; }
.gm-voice__play .gm-i-play { margin-inline-start: 2px; }
.gm-voice__play .gm-i-pause, .gm-voice.is-playing .gm-voice__play .gm-i-play, .gm-voice__play .gm-i-load { display: none; }
.gm-voice.is-playing .gm-voice__play .gm-i-pause { display: block; }
.gm-voice.is-loading .gm-voice__play .gm-i-play, .gm-voice.is-loading .gm-voice__play .gm-i-pause { display: none; }
.gm-voice.is-loading .gm-voice__play .gm-i-load { display: block; animation: gm-spin .8s linear infinite; }
@keyframes gm-spin { to { transform: rotate(360deg); } }
/* the bars share whatever room is left (never under the time / speed): each shrinks, the row clips */
.gm-voice__wave { position: relative; display: flex; flex: 1 1 0; min-width: 0; height: 1.9rem; align-items: center; gap: 2px; overflow: hidden; cursor: pointer; touch-action: none; }
.gm-voice__wave i { display: block; flex: 1 1 0; min-width: 1px; max-width: 3px; border-radius: 2px; background: color-mix(in oklch, var(--color-foreground) 24%, transparent); transition: background-color .12s; }
.gm-voice__wave i.is-on { background: var(--color-primary); }
.gm-voice__time { flex: none; font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .7; min-width: 2.2rem; text-align: center; padding-inline: .1rem; }
.gm-voice__rate { flex: none; height: 1.4rem; min-width: 2.2rem; padding: 0 .4rem; border-radius: 9999px; font-size: 11px; font-weight: 600; cursor: pointer; display: none;
    color: var(--color-primary); border: 1px solid color-mix(in oklch, var(--color-primary) 60%, transparent); background: color-mix(in oklch, var(--color-primary) 20%, transparent); }
.gm-voice.is-playing .gm-voice__rate, .gm-voice.was-played .gm-voice__rate { display: inline-flex; align-items: center; justify-content: center; }
.gm-voice.is-playing .gm-voice__time { opacity: 1; color: var(--color-primary); }

/* voice note ready (Messenger-style): the box becomes  🗑 · ▶ waveform · ↻ record again · ➤ send  — no text with it */
.gm-vbar { position: absolute; inset-inline: 0; bottom: 0; z-index: 3; display: none; min-height: 2.75rem; align-items: center; gap: .4rem; padding: .2rem .35rem;
    border-radius: 1.375rem; background: var(--color-background); border: 1px solid color-mix(in oklch, var(--color-primary) 30%, transparent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-primary) 8%, transparent); }
.gm-cbox.is-voice:not(.is-rec) .gm-vbar { display: flex; }
.gm-cbox.is-voice .gm-composer, .gm-cbox.is-voice .gm-media-btn, .gm-cbox.is-voice .gm-cbox__send { visibility: hidden; }
.gm-cbox.is-voice .gm-composer textarea { max-height: 2.75rem; }
.gm-vbar__player { flex: 1; min-width: 0; display: flex; }
.gm-vbar__player .gm-voice { width: 100%; }
.gm-vbar__redo { color: color-mix(in oklch, var(--color-foreground) 65%, transparent); }
.gm-vbar__redo:hover { background: color-mix(in oklch, var(--color-foreground) 7%, transparent); color: var(--color-foreground); }
.gm-vbar__send:disabled { opacity: .55; cursor: default; }
.gm-vbar__send svg { width: 16px; height: 16px; transform: translate(-1px, 1px); }
[dir=rtl] .gm-vbar__send svg { transform: translate(1px, 1px) scaleX(-1); }
