/*
 * The message bar of every chat on the website (chat with a seller, Messages, live chat): one rounded box with a
 * "+" for a photo inside it on the left, the words growing to the right of it, and the round send button beside
 * the box. A chosen photo sits inside the box above the words, with an x on its corner to take it out again.
 * Markup: .pv-compose > .pv-compose-box > (.pv-compose-photo, .pv-compose-row > (.pv-compose-add, textarea)), .pv-compose-send
 * Behaviour: frontend/js/site/chat-photo.js (pvChatPhoto.attach for the photo, pvChatPhoto.fit for the height).
 * Voice notes (frontend/js/site/chat-voice.js): while there is nothing to send, a microphone takes the send button's
 * place; recording turns the box into .pv-compose-rec (bin, red dot, time) and the send button sends the voice note.
 */
.pv-compose { display: flex; align-items: flex-end; gap: 8px; }
.pv-compose-box { flex: 1; min-width: 0; background: #fff; border: 1px solid #d7dde5; border-radius: 22px; transition: border-color .15s, box-shadow .15s; }
.pv-compose-box:focus-within { border-color: var(--theme); box-shadow: 0 0 0 3px rgba(0, 0, 0, .04); }
.pv-compose-row { display: flex; align-items: flex-end; }
.pv-compose-add { position: relative; flex: none; width: 40px; height: 40px; margin: 1px 0 1px 2px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    color: var(--theme); font-size: 17px; cursor: pointer; transition: background .15s, transform .15s; }
.pv-compose-add:hover { background: #f2f4f7; }
.pv-compose-add:focus-within { background: #f2f4f7; outline: 2px solid var(--theme); outline-offset: -2px; }
.pv-compose textarea { flex: 1; min-width: 0; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; resize: none;
    padding: 10px 14px 10px 4px; margin: 0; font-size: 15px; line-height: 20px; height: 42px; min-height: 42px; max-height: 132px; overflow-y: hidden; color: inherit; }
.pv-compose-send, .pv-compose-send-like { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; background: var(--theme); color: var(--theme-on, #fff);
    display: inline-flex; align-items: center; justify-content: center; font-size: 17px; cursor: pointer; transition: opacity .15s, transform .1s; }
.pv-compose-send:active { transform: scale(.94); }
.pv-compose-send:disabled { opacity: .5; cursor: default; }

/* The chosen photo, inside the box above the words. */
.pv-compose-photo { display: flex; align-items: center; gap: 10px; padding: 8px 10px 0; font-size: 12.5px; color: #667085; }
.pv-compose-photo[hidden] { display: none; }
.pv-compose-thumb { position: relative; flex: none; }
.pv-compose-thumb img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid #e4e7ec; }
.pv-compose-thumb button { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; padding: 0;
    background: #344054; color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pv-compose-thumb button:hover { background: #101828; }

/* Voice notes: the microphone in the send button's place while there is nothing to send. */
.pv-compose-mic { display: none; }
.pv-compose.can-record:not(.has-content) .pv-compose-send { display: none; }
.pv-compose.can-record:not(.has-content) .pv-compose-mic { display: inline-flex; }
.pv-compose-rec { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 4px; background: #fff;
    border: 1px solid #f5c2c0; border-radius: 22px; font-size: 14px; color: #344054; }
.pv-compose-rec[hidden], .pv-compose.recording .pv-compose-box, .pv-compose.retry .pv-compose-box { display: none; }
/* A voice note that was not sent: kept in the bar (no blinking dot), send tries again, the bin throws it away. */
.pv-compose.retry .pv-compose-rec-dot { display: none; }
.pv-compose.retry .pv-compose-rec-note { color: #b42318; }
.pv-compose-rec-bin { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: #b42318; cursor: pointer; font-size: 15px; }
.pv-compose-rec-bin:hover { background: #fef3f2; }
.pv-compose-rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #d92d20; animation: pvRecBlink 1s ease-in-out infinite; }
.pv-compose-rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.pv-compose-rec-note { flex: 1; min-width: 0; font-size: 12.5px; color: #98a2b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pvRecBlink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pv-compose-rec-dot { animation: none; } }

/* A voice note in a message: play/pause, a bar that fills as it plays, its length. Takes the bubble's colours. */
.pv-voice { display: flex; align-items: center; gap: 10px; min-width: 190px; max-width: 260px; padding: 2px 0; }
.pv-voice-play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    background: currentColor; font-size: 13px; }
.pv-voice-play i { color: #fff; }
.mine .pv-voice-play, .pv-voice-mine .pv-voice-play { background: rgba(255, 255, 255, .25); }
.pv-voice-play i.fa-play { margin-left: 2px; }
.pv-voice-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(127, 127, 127, .35); position: relative; overflow: hidden; }
.pv-voice-bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: currentColor; }
.pv-voice-time { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; }

@media (max-width: 600px) {
    .pv-compose textarea { font-size: 16px; } /* 16px or more: iPhones don't zoom the page when it is tapped */
}
