/* Voice and video calls (js/calls.js): the call buttons of a conversation's bar, the ringing screen, the call screen
   (a tile per person: their picture, or their camera), the call's line in the conversation. */
.dm-call { width: 32px; height: 32px; border-radius: 50%; background: none; font-size: 16px; flex: none; }
.dm-call:hover { background: rgba(0, 0, 0, .06); }

/* above everything of the table (a kiss's question too); while it is open the toasts come above it */
.call-ov { position: fixed; inset: 0; z-index: 2147483200; display: flex; flex-direction: column; color: #fff;
  background: radial-gradient(circle at 50% 20%, #4b2384 0%, #22103f 55%, #120822 100%); font-family: inherit; }

body.in-call #toasts { z-index: 2147483300; }

/* ringing */
.call-ring { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.call-ring-ph { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255, 255, 255, .85); animation: call-pulse 1.6s ease-out infinite; }
.call-ring-name { font-size: 26px; margin-top: 14px; }
.call-ring-what { opacity: .85; font-size: 16px; }
.call-ring-price { opacity: .65; }
.call-ring-btns { display: flex; gap: 34px; margin-top: auto; padding-top: 40px; }
@keyframes call-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); } 100% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); } }

/* the call */
.call-main { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: calc(10px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)); }
.call-top { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 10px; text-align: center; }
.call-title { font-size: 20px; }
.call-status { font-variant-numeric: tabular-nums; opacity: .9; }
.call-price { opacity: .65; font-size: 12px; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.call-grid.n2 { grid-template-columns: 1fr; }
.call-grid.n3, .call-grid.n4 { grid-template-columns: 1fr 1fr; }
.call-grid.n5, .call-grid.n6, .call-grid.n7, .call-grid.n8, .call-grid.n9 { grid-template-columns: 1fr 1fr 1fr; }
@media (min-width: 700px) { .call-grid.n2 { grid-template-columns: 1fr 1fr; } }
.call-tile { position: relative; overflow: hidden; border-radius: 16px; background: rgba(255, 255, 255, .07); display: flex; align-items: center; justify-content: center; min-height: 0; }
.call-tile-ph { width: min(40%, 140px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.call-tile-v { position: absolute; inset: 0; display: none; }
.call-tile-v video { width: 100%; height: 100%; object-fit: cover; }
.call-tile.has-video .call-tile-v { display: block; }
.call-tile.has-video .call-tile-ph { visibility: hidden; }
.call-tile.me .call-tile-v video { transform: scaleX(-1); }
.call-tile.ringing .call-tile-ph { opacity: .55; animation: call-pulse 1.6s ease-out infinite; }
.call-tile.speaking { box-shadow: inset 0 0 0 3px #4ade80; }
.call-tile-name { position: absolute; bottom: 8px; inset-inline-start: 10px; font-size: 13px; padding: 2px 8px; border-radius: 10px; background: rgba(0, 0, 0, .45); max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* one-to-one: the other person fills the screen, my own picture is small in a corner */
.call-grid.n2 { position: relative; }
.call-grid.n2 .call-tile.me { position: absolute; z-index: 2; width: 30%; max-width: 160px; aspect-ratio: 3 / 4; top: 10px; inset-inline-end: 10px; border: 2px solid rgba(255, 255, 255, .5); }
.call-grid.n2 .call-tile.me:not(.has-video) { display: none; }
@media (min-width: 700px) { .call-grid.n2 .call-tile.me { position: relative; width: auto; max-width: none; aspect-ratio: auto; top: 0; inset-inline-end: 0; border: 0; } .call-grid.n2 .call-tile.me:not(.has-video) { display: flex; } }
.call-bar { display: flex; justify-content: center; gap: 16px; padding-top: 14px; flex-wrap: wrap; }

.call-btn { width: 60px; height: 60px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: rgba(255, 255, 255, .16); border: 0; cursor: pointer; }
.call-btn:hover { background: rgba(255, 255, 255, .26); }
.call-btn.off { background: #fff; color: #22103f; }
.call-btn.off::after { content: ''; position: absolute; width: 30px; height: 3px; background: currentColor; transform: rotate(-45deg); border-radius: 2px; }
.call-btn { position: relative; }
.call-btn.end { background: #e5394c; }
.call-btn.end svg { transform: rotate(135deg); }
.call-btn.ok { background: #22b45b; animation: call-wiggle 1.2s ease-in-out infinite; }
@keyframes call-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(0); } }

/* ringing a friend into the call */
.call-pick { position: absolute; z-index: 3; inset-inline: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); max-height: 55%; overflow: auto; background: #fff; color: #222; border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); max-width: 420px; margin-inline: auto; }
.call-pick-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #eee; position: sticky; top: 0; background: #fff; }
.call-pick-x { background: none; border: 0; font-size: 18px; cursor: pointer; }
.call-pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; background: none; border: 0; text-align: start; cursor: pointer; font: inherit; }
.call-pick-row:hover { background: #f5f0ff; }
.call-pick-row img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.call-pick-row .on { width: 9px; height: 9px; border-radius: 50%; background: #22b45b; margin-inline-start: auto; }
.call-pick-none { padding: 16px; margin: 0; color: #777; text-align: center; }

/* the call's line in the conversation */
.call-line { align-self: center; display: flex; align-items: center; gap: 10px; margin: 8px auto; padding: 8px 14px; border-radius: 14px; background: rgba(120, 80, 200, .1); color: inherit; max-width: 92%; }
.call-line-ico { color: #22b45b; display: inline-flex; }
.call-line.missed .call-line-ico { color: #e5394c; }
.call-line-txt { display: flex; flex-direction: column; line-height: 1.25; }
.call-line-txt small { opacity: .7; font-variant-numeric: tabular-nums; }
.call-line-back { border: 0; border-radius: 12px; padding: 4px 10px; background: #7c4dff; color: #fff; font: inherit; font-size: 12px; cursor: pointer; }

/* my profile's Calls card: which calls I accept from my friends (off until I turn them on) */
.pf2-call-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.pf2-call-row + .pf2-call-row { border-top: 1px solid #f0ebfa; }
.pf2-call-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, #efe7ff, #ffe6f2); }
.pf2-call-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pf2-call-txt b { font-size: 13.5px; color: #382a63; }
.pf2-call-txt small { font-size: 11.5px; color: #8a80a6; }
.pf2-switch { position: relative; flex: 0 0 44px; width: 44px; height: 26px; border-radius: 100px; border: 0; padding: 0; background: #d5d0e0; cursor: pointer; transition: background .15s; }
.pf2-switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .15s; }
.pf2-switch.on { background: linear-gradient(90deg, #7957b2, #e0457b); }
.pf2-switch.on i { inset-inline-start: 21px; }
