/* Cam x Cam V1.1, scoped to the chat and independent of floating public cameras. */
.chat-app{position:relative}
#ecCallCard1[hidden],#ecCallDock1[hidden],.ec-call-launch[hidden],#ecCallCard1 button[hidden]{display:none!important}
#ecCallCard1{position:absolute;z-index:1800;top:100px;right:16px;width:min(460px,calc(100% - 32px));max-height:calc(100% - 116px);display:flex;flex-direction:column;background:#fff;border:1px solid #527daf;border-radius:12px;box-shadow:0 10px 35px #20365340;overflow:auto;color:#22344a;font:14px Arial,sans-serif;box-sizing:border-box}
#ecCallCard1 .ec-call-head{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#2868ad;color:#fff;padding:8px 12px;border-radius:10px 10px 0 0}
#ecCallCard1 .ec-call-head strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#ecCallCard1 button,#ecCallDock1 button,.ec-call-launch,.ec-call-settings button{font:inherit;cursor:pointer;border:1px solid #c1d1e4;border-radius:7px;background:#edf4fc;color:#17477c;padding:8px 10px;min-height:36px}
#ecCallCard1 button:focus-visible,#ecCallDock1 button:focus-visible,.ec-call-launch:focus-visible{outline:3px solid #f4b63f;outline-offset:2px}
#ecCallCard1 button:disabled{opacity:.55;cursor:wait}
#ecCallCard1 .ec-call-danger,#ecCallDock1 .ec-call-danger{background:#ab3040;color:#fff;border-color:#ab3040}
#ecCallStatus1{padding:8px 12px;margin:0;font-size:13px;min-height:32px;box-sizing:border-box}
#ecCallCard1 .ec-call-stage{position:relative;flex:0 0 auto;min-height:140px;height:240px;background:#e8eef5;overflow:hidden}
#ecCallRemote1{width:100%;height:100%;object-fit:contain;background:#15283c}
#ecCallSelf1{position:absolute;bottom:10px;right:10px;width:100px;height:76px;object-fit:cover;transform:scaleX(-1);border:2px solid #fff;border-radius:8px;background:#dce6f0;z-index:2}
#ecCallPlaceholder1{position:absolute;top:25%;left:15%;width:70%;text-align:center;color:#fff;font-size:14px}
#ecCallNotice1{padding:8px 12px;margin:0;font-size:12px;line-height:1.4}
#ecCallCard1 .ec-call-actions{display:flex;flex-wrap:wrap;gap:6px;padding:10px 12px}
#ecCallCard1 footer{border-top:1px solid #e1e8f0;padding:8px 12px;display:flex;gap:8px;flex-wrap:wrap}
#ecCallCard1 footer button{font-size:12px;min-height:32px;padding:5px 8px}
#ecCallCard1 footer span{display:block;width:100%;font-size:11px;color:#596b80;line-height:1.4}
#ecCallDock1{position:absolute;z-index:1801;bottom:90px;left:12px;right:12px;margin:auto;max-width:450px;display:flex;gap:6px;padding:7px;background:#fff;border:1px solid #7ca3ce;border-radius:9px;box-shadow:0 4px 18px #20365330}
#ecCallReturn1{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ec-call-launch{font-size:12px!important;white-space:nowrap;flex-shrink:0;padding:5px 8px!important;min-height:30px!important}
#ecCallLaunchMobile1{display:none}
.ec-call-settings{margin-top:16px;padding:12px;border:1px solid #d2deec;border-radius:8px;font-size:13px}.ec-call-settings p{margin:6px 0;font-size:12px}
@media(max-width:760px),(max-height:600px) and (max-width:1000px){
 #ecCallLaunchDesktop1{display:none!important}#ecCallLaunchMobile1:not([hidden]){display:inline-flex;align-items:center}
 #ecPrivateControls1{gap:5px!important}#ecPrivateName1{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 #ecCallCard1{top:8px;right:8px;width:calc(100% - 16px);max-height:calc(100% - 16px)}
 #ecCallCard1 .ec-call-stage{height:clamp(140px,32dvh,280px)}
 #ecCallCard1 .ec-call-actions{padding:8px;gap:5px}#ecCallCard1 .ec-call-actions button{font-size:12px;min-height:38px}
 #ecCallDock1{bottom:76px;left:6px;right:6px}
}
@media(max-height:450px){#ecCallCard1 .ec-call-stage{height:140px}#ecCallCard1 footer span{display:none}}

#ecCallCard1 .ec-call-stage[hidden]{display:none!important}

/* V1.2: nombre flexible, Videollamada, minimizar y cerrar; evita ancho 32 px heredado. */
@media(max-width:760px),(max-height:600px) and (max-width:1000px){
 #ecPrivateControls1{box-sizing:border-box;max-width:100%;flex-wrap:nowrap}
 #ecPrivateControls1 #ecPrivateName1{flex:1 1 0;min-width:0}
 #ecPrivateControls1 #ecCallLaunchMobile1{flex:0 0 auto;width:auto;min-width:0;height:32px;min-height:32px!important;padding:0 8px!important;font-size:12px!important;white-space:nowrap;line-height:1.2}
}

/* Mobile video stage and owner-only camera flip. */
#ecCallCard1{width:min(520px,calc(100% - 32px));border-radius:14px}
#ecCallCard1 .ec-call-head{gap:6px;padding:8px 10px}
#ecCallCard1 .ec-call-head strong{flex:1;font-size:14px}
#ecCallCard1 .ec-call-head button{flex:0 0 34px;width:34px;height:34px;min-height:34px;padding:0;background:#ffffff1f;color:#fff;border:1px solid #ffffff50;font-size:21px}
#ecCallCard1 .ec-call-stage{height:300px;background:#14283c}
#ecCallSelf1{width:92px;height:118px;bottom:12px;right:12px;border-radius:10px;box-shadow:0 3px 14px #0005}
.ec-call-self-label{position:absolute;bottom:15px;right:20px;z-index:3;border-radius:4px;padding:0 4px;font-size:11px;background:#0008;color:#fff}
#ecCallCard1:not(.ec-has-preview) .ec-call-self-label{display:none}
#ecCallCard1.ec-has-preview:is([data-phase="preview"],[data-phase="incoming"]) #ecCallSelf1{inset:0;width:100%;height:100%;border:0;border-radius:0;object-fit:contain}
#ecCallCard1.ec-has-preview:is([data-phase="preview"],[data-phase="incoming"]) #ecCallPlaceholder1{display:none}
#ecCallCard1 .ec-call-actions{gap:6px}
#ecCallCard1 .ec-call-actions button{flex:1 1 auto;min-height:44px}
#ecCallCard1 footer{padding:8px 12px;display:block}
#ecCallCard1 footer details{width:100%}
#ecCallCard1 footer summary{font-size:12px;cursor:pointer;color:#315579;min-height:28px;display:list-item}
#ecCallCard1 footer details button{margin:6px 6px 6px 0}
.ec-camera-flip1{position:absolute;bottom:8px;left:8px;z-index:12;display:flex;align-items:center;gap:5px;min-height:36px;padding:5px 9px;background:#173c64e8;color:#fff;border:1px solid #fff9;border-radius:8px;font:12px system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.ec-camera-flip1>span:first-child{font-size:22px;line-height:1}
.ec-camera-flip1:disabled{opacity:.55;cursor:wait}
.ec-camera-flip1:focus-visible{outline:3px solid #f4b63f;outline-offset:2px}
.floating-camera.minimized .ec-camera-flip1{display:none}
.mobile-local-mini .ec-camera-flip1{left:4px;bottom:4px;padding:3px 6px;min-height:32px}
.mobile-local-mini .ec-flip-label{display:none}
@media(max-width:760px),(max-height:600px) and (max-width:1000px){
 #ecCallCard1{width:calc(100% - 12px);right:6px;top:6px;max-height:calc(100% - 12px)}
 #ecCallCard1 .ec-call-stage{height:clamp(180px,44dvh,480px)}
 #ecCallCard1 .ec-call-actions{padding:8px;display:flex;flex-wrap:wrap}
 #ecCallCard1 .ec-call-actions button{font-size:12px;padding:8px 6px;min-height:44px}
 #ecCallCard1[data-phase="active"] .ec-call-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
 #ecCallCard1 #ecCallPlay1:not([hidden]){grid-column:1/-1}
 #ecCallCard1 footer{padding:6px 10px}
 #ecCallStatus1{font-size:12px;padding:7px 10px;min-height:30px}
}
@media(max-height:500px){#ecCallCard1 .ec-call-stage{height:150px}#ecCallSelf1{width:70px;height:90px}}
/* V1.1: larger video, reversible viewport view; keep complete image. */
#ecCallCard1 .ec-call-head button{min-width:34px}
#ecCallCard1[data-phase="active"] .ec-call-stage{height:390px}
#ecCallCard1.ec-call-expanded{
 position:fixed;inset:auto;top:calc(var(--ec-view-top,0px) + 4px);left:calc(var(--ec-view-left,0px) + 4px);right:auto;bottom:auto;
 width:calc(var(--ec-view-width,100vw) - 8px);height:calc(var(--ec-view-height,100dvh) - 8px);max-width:none;max-height:none;z-index:12000;border-radius:10px
}
#ecCallCard1.ec-call-expanded .ec-call-stage{flex:1 1 0;height:auto!important;min-height:100px}
#ecCallCard1.ec-call-expanded .ec-call-head,#ecCallCard1.ec-call-expanded .ec-call-actions,#ecCallCard1.ec-call-expanded footer,#ecCallCard1.ec-call-expanded p{flex:0 0 auto}
#ecCallRemote1{object-fit:contain}
@media(max-width:760px),(max-height:600px) and (max-width:1000px){
 #ecCallCard1[data-phase="active"] .ec-call-stage{height:clamp(190px,58dvh,620px)}
 #ecCallCard1 .ec-call-head{padding:6px;gap:4px}
 #ecCallCard1 .ec-call-head strong{font-size:13px}
}
@media(max-height:500px){#ecCallCard1[data-phase="active"] .ec-call-stage{height:180px}}

#ecCallCard1 #ecCallFit2{position:absolute;top:8px;right:8px;z-index:4;background:#173c64e8;color:#fff;border-color:#ffffff99;font-size:12px;min-height:34px;padding:6px 9px}
#ecCallCard1:not([data-phase="active"]) #ecCallFit2{display:none!important}
#ecCallCard1.ec-video-fill #ecCallRemote1{object-fit:cover}

.mobile-local-mini .ec-flip-label{display:inline;font-size:10px}
.ec-camera-flip1:disabled,#ecCallFlip1:disabled{cursor:default;opacity:.72}

#ecCallRecover4{grid-column:1/-1}

/* Ver y escribir V1: los dos videos conservan sus nodos y MediaStreams. */
#ecCallExpand2 svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;vertical-align:middle}
html body .chat-app #messages.ec-call-writing-space{margin-right:278px!important;min-width:0}
#ecCallCard1.ec-call-writing{position:fixed;inset:auto;left:var(--ec-write-left);top:var(--ec-write-top);right:auto;bottom:auto;width:var(--ec-write-width);height:var(--ec-call-write-height);max-height:none;max-width:none;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:36px minmax(0,1fr);gap:0;overflow:hidden;z-index:1800;border-radius:10px}
#ecCallCard1.ec-call-writing .ec-call-head{grid-column:1/-1;padding:2px 5px;gap:3px;border-radius:8px 8px 0 0;min-width:0}
#ecCallCard1.ec-call-writing .ec-call-head strong{font-size:12px}
#ecCallCard1.ec-call-writing .ec-call-head button{min-width:32px;width:32px;height:32px;min-height:32px;flex-basis:32px}
#ecCallCard1.ec-call-writing .ec-call-stage{grid-column:1;grid-row:2;min-height:0!important;height:100%!important;min-width:0}
#ecCallCard1.ec-call-writing #ecCallRemote1{display:block;object-fit:contain}
#ecCallCard1.ec-call-writing #ecCallSelf1{width:32px;height:40px;right:3px;bottom:3px;border-width:1px;border-radius:4px}
#ecCallCard1.ec-call-writing :is(#ecCallStatus1,#ecCallNotice1,footer,.ec-call-self-label,#ecCallFit2){display:none!important}
#ecCallCard1.ec-call-writing .ec-call-actions{grid-column:2;grid-row:2;display:flex;flex-direction:column;justify-content:center;flex-wrap:nowrap;gap:4px;padding:4px;min-height:0;overflow:auto}
#ecCallCard1.ec-call-writing .ec-call-actions button{flex:0 0 auto;min-height:36px;font-size:12px;padding:5px}
#ecCallCard1.ec-call-writing .ec-call-actions button:not(#ecCallMic1):not(#ecCallEnd1):not(#ecCallPlay1){display:none!important}
@media(min-width:1101px) and (min-height:601px){
 #ecCallCard1.ec-call-writing{grid-template-columns:1fr;grid-template-rows:36px minmax(0,1fr) 44px}
 #ecCallCard1.ec-call-writing .ec-call-stage{grid-column:1;grid-row:2}
 #ecCallCard1.ec-call-writing .ec-call-actions{grid-column:1;grid-row:3;flex-direction:row;align-items:center}
 #ecCallCard1.ec-call-writing .ec-call-actions button{flex:1 1 auto}
}
@media(max-width:1100px),(max-height:600px){
 html body .chat-app #messages.ec-call-writing-space{margin-right:0!important;margin-top:var(--ec-call-write-height,150px)!important}
 #ecCallCard1.ec-call-writing .ec-call-actions{flex-direction:row;align-items:center;flex-wrap:wrap}
 #ecCallCard1.ec-call-writing .ec-call-actions button{flex:1 1 48px;min-width:0}
}

/* V2: la cabecera de la llamada ocupa arriba las barras del chat sólo en móvil.
   Al ampliar, ocultar o colgar se restaura la navegación original. */
@media(max-width:760px),(max-height:600px) and (max-width:1000px){
 html body.ec-compact-ready .chat-app.ec-call-top-mobile>.topbar,
 html body.ec-compact-ready .chat-app.ec-call-top-mobile>#ecPrivateControls1{display:none!important}
}

/* V3: tablet follows the visible viewport while writing or hiding an active call.
   No orientation lock, no video reparenting; all layout is reversible. */
html body .chat-app.ec-call-tablet-fit{
 position:fixed!important;top:var(--ec-tablet-top,0px)!important;left:8px!important;
 width:calc(100% - 16px)!important;height:var(--ec-tablet-height,100dvh)!important;
 min-height:0!important;max-height:none!important;margin:0!important;
 box-sizing:border-box;padding-bottom:env(safe-area-inset-bottom,0px)!important;
}
html body .chat-app.ec-call-tablet-fit .chat-main{min-height:0!important}
html body .chat-app.ec-call-tablet-writing>.brandbar,
html body .chat-app.ec-call-tablet-writing>.topbar{display:none!important}
html body .chat-app.ec-call-tablet-writing #messages.ec-call-writing-space{
 margin-right:0!important;margin-top:var(--ec-call-write-height,220px)!important;
}
#ecCallCard1.ec-call-writing.ec-call-tablet-strip{
 grid-template-columns:minmax(0,1fr);grid-template-rows:36px minmax(0,1fr) 46px;
}
#ecCallCard1.ec-call-writing.ec-call-tablet-strip .ec-call-stage{grid-column:1;grid-row:2}
#ecCallCard1.ec-call-writing.ec-call-tablet-strip .ec-call-actions{
 grid-column:1;grid-row:3;flex-direction:row;align-items:center;flex-wrap:nowrap;
}
#ecCallCard1.ec-call-writing.ec-call-tablet-strip .ec-call-actions button{flex:1 1 0;min-width:0}
#ecCallCard1.ec-call-writing.ec-call-tablet-strip #ecCallSelf1{width:44px;height:56px}
/* Hidden call: reserve a row above the conversation instead of floating over the composer. */
html body .chat-app #messages.ec-call-dock-space{margin-top:var(--ec-call-dock-height,58px)!important}
#ecCallDock1{
 position:fixed;top:var(--ec-dock-top,8px);left:var(--ec-dock-left,8px);right:auto;bottom:auto;
 width:var(--ec-dock-width,calc(100% - 16px));max-width:none;margin:0;box-sizing:border-box;
}
