/*  Gorusme sahnesi, video izgarasi, tam ekran, ekran paylasimi  */

/* --app-h: telefon klavyesi acikken gorunur alanin yuksekligi (app.js fitToVisualViewport) */

.screen { width: 100%; height: var(--app-h, 100dvh); display: flex; }

.call-chat-btn { margin-left: auto; position: relative; }

.call-chat-btn.active { color: var(--primary-ink); }

.call-chat-btn .unread-dot {
    position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
    border-radius: var(--radius); background: var(--danger);
}

.call-stage {
    flex: 1; min-width: 0; min-height: 0;
    display: flex; flex-direction: column;
    background: var(--bg-dark);
}

.call-stage-head {
    display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
    padding: 0.9rem 1.2rem 0.3rem; font-weight: 600; font-size: 0.95rem;
}

.call-stage-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.call-stage-count { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; white-space: nowrap; }

/* Dar sahnede (yatay telefon, bolunmus duzen) duzen dugmeleri saga tasiyor, oda adi 0 genislige iniyordu:
   sigmazsa dugmeler alt satira iner, ad gorunur kalir */
.call-stage-head { flex-wrap: wrap; row-gap: 0.35rem; }
.call-stage-name { min-width: 0; flex: 0 1 auto; }
.call-stage-head > .call-layout { margin-left: auto; }

/* ---------- Video izgarasi (goruntulu konusma) ---------- */

/* Kutu genisligi (--tw) fitStage() hesaplar: en buyuk 16/9 kutuyu veren sutun sayisi, son satir ortada.
   Ekran paylasimi varsa o ana kutu (tam genislik, --main-h), digerleri altta serit */

.video-grid {
    flex: 1; min-height: 0; overflow: hidden;
    display: flex; flex-wrap: wrap; justify-content: center; align-content: center;
    gap: 8px; padding: 0.8rem 1.2rem 1.2rem;
}

.video-grid > * { width: var(--tw, 200px); flex: none; transition: width var(--d-base) var(--e-out); }

/* order: kamerasi once acik olsa da (DOM'da once) ekran paylasimi ustte, kameralar altta seritte */

.video-grid > .stage-main { width: 100%; height: var(--main-h); aspect-ratio: auto; order: -1; }

.video-tile {
    position: relative; aspect-ratio: 16/9; border-radius: var(--radius);
    overflow: hidden; background: #000;
}

.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Konusma: kamerali kutuda kenar, sesli kutuda avatar halkasi */

.video-tile { outline: 2px solid transparent; outline-offset: -2px; transition: outline-color var(--d-fast) var(--e-out), width var(--d-base) var(--e-out); }

.video-tile.speak { outline-color: var(--success); }

.tile-mic { display: none; margin-left: 0.3rem; color: var(--danger); }

.tile-mic .vs-icon, .tile-mic .vs-icon.forced { color: inherit; }

.muted > .video-tile-name .tile-mic { display: inline-flex; vertical-align: -2px; }

.video-tile-name {
    position: absolute; left: 0.5rem; bottom: 0.4rem;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 0.75rem;
    padding: 0.15rem 0.5rem; border-radius: var(--radius);
    /* Uzun ad iki satira inip kutudaki avatarin ustune biniyordu: tek satir, sigmayan kismi "…" */
    max-width: calc(100% - 1rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#btn-camera.active,
#btn-screen-share.active { color: var(--primary-ink); background: color-mix(in srgb, var(--primary) 16%, transparent); }

/* Ekran paylasimi kutucugu: icerik cogu zaman 16/9 degildir, kirpmak yerine sigdir */

.video-tile-screen video { object-fit: contain; background: #000; }

/* Tiklama kutuyu buyutur (ana kutu); tam ekran kosedeki dugmeyle */

.video-tile { cursor: pointer; }

.video-grid > .stage-main video { object-fit: contain; background: #000; }

.tile-fs {
    position: absolute; right: 0.4rem; top: 0.4rem; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; border-radius: var(--radius); cursor: pointer;
    background: rgba(0,0,0,0.55); color: #fff;
    opacity: 0; transition: opacity var(--d-fast) var(--e-out), background var(--d-fast) var(--e-out);
}

.video-tile:hover > .tile-fs, .tile-fs:focus-visible { opacity: 1; }

.tile-fs:hover { background: rgba(0,0,0,0.8); }

@media (hover: none) { .tile-fs { opacity: 1; } }

/* Yayin kutusu kontrolleri (video/tile-controls.js): sag altta ses + buyutec, bar yukari acilir; kutuya ozel */
.video-tile video { transition: transform 80ms linear; }
.video-tile.dragging video { transition: none; }
.video-tile.zoomed { cursor: grab; }
.video-tile.dragging { cursor: grabbing; }
.tile-ctl {
    position: absolute; right: 0.4rem; bottom: 0.4rem; z-index: 1; display: flex; gap: 4px;
    opacity: 0; transition: opacity var(--d-fast) var(--e-out);
}
.video-tile:hover > .tile-ctl, .tile-ctl:focus-within, .tile-ctl:has(.tc.open) { opacity: 1; }
@media (hover: none) { .tile-ctl { opacity: 1; } }
/* Ses dugmesi yalniz yayin ses tasiyorsa (sfu-client .has-audio verir) */
.video-tile:not(.has-audio) .tile-ctl-vol { display: none; }
.tc-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; border-radius: var(--radius); cursor: pointer;
    background: rgba(0,0,0,0.55); color: #fff;
}
.tc-btn:hover, .tc.open .tc-btn { background: rgba(0,0,0,0.85); }
.tc-btn.changed { color: var(--primary); }
/* fixed: kutunun overflow'unu asar, kucuk kutuda da tam boy (konumu openTileCtl verir) */
.tc-pop {
    position: fixed; z-index: 50; display: none; flex-direction: column; align-items: center; gap: 6px;
    min-width: 44px; padding: 8px 6px; border-radius: var(--radius);
    background: rgba(14,12,26,0.94); border: 1px solid rgba(255,255,255,0.09); cursor: default;
}
.tc-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; } /* fare butona inerken kapanmasin */
.tc.open .tc-pop { display: flex; }
.tc-val { font-size: 11px; color: #fff; min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
/* genel input[type=range] (base.css: yatay, 6px, flex:1) gorunumu korunur, yalniz dikeye cevrilir */
.tc-pop input.tc-range { writing-mode: vertical-lr; direction: rtl; flex: none; width: 6px; height: 110px; margin: 6px 0; }
.tc-reset { font-size: 10px; background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; padding: 0; }
.tc-reset:hover { color: #fff; }

/* Tam ekran (fullscreen.js): sahnenin kendisi; kutu kontrolleri ve alt bar yerinde kalir.
   z 950: pencerelerin (.modal 1000+) ve menulerin altinda, uygulamanin ustunde */
.call-stage.stage-fs { position: fixed; inset: 0; z-index: 950; min-width: 0; background: #000; }
.call-stage.stage-fs .call-stage-head { display: none; }
.call-stage.stage-fs .video-grid { padding: 0.5rem 0.5rem 72px; }   /* alt bar profil seridini ortmesin */
/* Katilimci seridi gizli: yalniz ana kutu kalir */
.video-grid.strip-hidden > :not(.stage-main) { display: none; }
/* Serit dugmesi: ana kutunun alt ortasi (seridin hemen ustu); alt bar gibi fare sahnedeyken gorunur */
.stage-strip-toggle {
    position: absolute; left: 50%; bottom: calc(72px + var(--strip-space, 0px) + 8px); z-index: 6;
    display: flex; align-items: center; gap: 2px; padding: 4px 10px;
    background: rgba(8, 7, 15, 0.82); color: #fff; cursor: pointer;
    border: 1px solid var(--border); border-radius: 999px;
    opacity: 0; transform: translateX(-50%); pointer-events: none;
    transition: opacity var(--d-base) var(--e-out);
}
.stage-strip-toggle:hover { background: rgba(8, 7, 15, 0.95); }
.call-stage:hover .stage-strip-toggle, .stage-strip-toggle:focus-visible { opacity: 1; pointer-events: auto; }
@media (hover: none) { .stage-strip-toggle { opacity: 1; pointer-events: auto; } }
.stage-strip-toggle.hidden { display: none; }

@media (max-width: 768px) {
    .call-stage { flex: 0 0 45%; }
}

/* ---------- Ekran paylas penceresi ---------- */

/* Ic bosluk bolumlerde: alt serit ve sekme cizgisi kenardan kenara uzanir */

.ss-modal { max-width: 640px; padding: 0; overflow: hidden; }

.ss-modal .modal-header { padding: 1.2rem 1.25rem 0; margin-bottom: .6rem; }

.ss-modal .modal-body { padding: 1rem 1.25rem; }

/* Sekmeler: secili olanin altinda ana renk cizgi */

.ss-tabs { display: flex; gap: .25rem; padding: 0 1.25rem; border-bottom: 1px solid var(--border); }

.ss-tabs button {
    background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted);
    padding: .6rem .75rem; font: inherit; font-weight: 600; cursor: pointer;
    transition: color var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out);
}

.ss-tabs button:hover { color: var(--text-main); }

.ss-tabs button[aria-selected="true"] { color: var(--text-main); border-bottom-color: var(--primary); }

/* Kaynak listesi: ince, yuvarlak, kenara yapismayan kaydirma cubugu */

.ss-sources {
    max-height: 46vh; overflow-y: auto; padding-right: .35rem; margin-right: -.35rem;
    scrollbar-width: thin; scrollbar-color: var(--bg-hover) transparent;
}

.ss-sources::-webkit-scrollbar { width: 6px; }

.ss-sources::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 999px; }

.ss-sources::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.ss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }

.ss-source {
    display: flex; flex-direction: column; gap: .4rem; padding: .4rem; text-align: left;
    background: var(--bg-panel); border: 2px solid transparent; border-radius: var(--radius);
    color: var(--text-main); cursor: pointer;
}

.ss-source:hover { background: var(--bg-hover); }

.ss-source[aria-selected="true"] { border-color: var(--primary); }

.ss-source img, .ss-thumb-empty {
    width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: var(--bg-darker);
    border-radius: calc(var(--radius) * .6);
}

.ss-source span { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ss-loading { color: var(--text-muted); font-size: .85rem; padding: .5rem 0; }

/* Alt serit: kalite secimi (hep gorunur) + Yayina basla */

.ss-foot {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem;
    padding: .9rem 1.25rem 1.1rem; background: var(--bg-darker); border-top: 1px solid var(--border);
}

.ss-quality { display: flex; flex-wrap: wrap; gap: .9rem; }

.ss-q-label { display: block; font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }

.ss-pills { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-panel); border-radius: var(--radius); }

.ss-pills button {
    background: none; border: 0; color: var(--text-muted); padding: .3rem .7rem; font: inherit; font-size: .82rem;
    border-radius: calc(var(--radius) * .7); cursor: pointer;
}

.ss-pills button:hover { color: var(--text-main); }

.ss-pills button[aria-checked="true"] { background: var(--bg-hover); color: var(--text-main); font-weight: 600; }

/* =========================================================================
   GORUSME DUZENI: yalnizca profiller / ikisi / yalnizca sohbet + surukleme cubugu
   ========================================================================= */

.call-layout {
    display: inline-flex; gap: 2px; padding: 3px; margin-left: auto; flex: none;
    background: var(--bg-panel); border-radius: var(--radius);
}

.call-layout button {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 28px; border: none; border-radius: var(--radius); background: none; cursor: pointer;
    color: var(--text-muted); transition: background var(--d-fast) var(--e-out), color var(--d-fast) var(--e-out);
}

.call-layout button:hover { color: var(--text-main); background: rgba(var(--ov), 0.08); }

.call-layout button.active { background: var(--bg-darker); color: var(--primary-ink); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

.call-layout .unread-dot {
    position: absolute; top: 3px; right: 4px; width: 7px; height: 7px; border-radius: var(--radius); background: var(--danger);
}

.call-splitter {
    flex: 0 0 6px; cursor: col-resize; position: relative; background: var(--border);
    touch-action: none; outline: none; transition: background var(--d-fast) var(--e-out);
}

.call-splitter::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 2px; height: 36px; border-radius: var(--radius);
    transform: translate(-50%, -50%); background: var(--text-muted); opacity: 0.5;
}

.call-splitter:hover, .call-splitter:focus-visible { background: var(--primary); }

.call-stage { min-width: 240px; }

/* Yalnizca profil (kamerasiz) kutular: kart gorunumu, avatar kutu boyutuyla buyur */

.video-grid .voice-tile { container-type: size; }

.video-grid.profiles-only .voice-tile {
    background: radial-gradient(circle at 50% 38%, rgba(var(--ov), 0.06), transparent 65%), var(--bg-panel);
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .call-splitter { display: none !important; }
}

/* ---------- Sahne alt kontrol cubugu (app.js bindStageControls): fare sahnedeyken belirir ---------- */

.call-stage { position: relative; }

.stage-controls {
    position: absolute; left: 50%; bottom: 14px; z-index: 6;
    display: flex; gap: 6px; padding: 7px;
    background: rgba(8, 7, 15, 0.82); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    opacity: 0; transform: translate(-50%, 8px); pointer-events: none;
    transition: opacity var(--d-base) var(--e-out), transform var(--d-base) var(--e-out);
}

.call-stage:hover .stage-controls, .stage-controls:focus-within {
    opacity: 1; transform: translate(-50%, 0); pointer-events: auto;
}

/* Dokunmatikte fareyle uzerine gelme yok: hep gorunur */

@media (hover: none) { .stage-controls { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; } }
/* Kontrol cubugu hep gorunurken (dokunmatik / telefon) alttaki kutularin ustune binmesin: izgara ona yer ayirir */
@media (hover: none), (max-width: 768px) { .video-grid { padding-bottom: 76px; } }

/* Dar sahnede (kucuk pencere) cubuk sahneden tasip kanal listesinin ustune biniyordu: sahneye sigar, dugmeler daralir */
.stage-controls { max-width: calc(100% - 16px); }
.stage-controls .sc-btn {
    flex: 0 1 42px; min-width: 30px;
    width: 42px; height: 42px; border-radius: calc(var(--radius) * 1.2);
    background: var(--bg-panel); color: var(--text-main);
}

.stage-controls .sc-btn:hover { background: var(--bg-hover); }

/* Yayindan ayril: kapali mikrofon gibi kirmizi (gri halde ne yaptigi anlasilmiyordu) */
.stage-controls #btn-stage-leave-stream { color: var(--danger); background: rgba(239, 68, 68, 0.16); }
.stage-controls #btn-stage-leave-stream:hover { background: rgba(239, 68, 68, 0.28); }

.stage-controls .sc-btn.active { color: var(--danger); background: rgba(239, 68, 68, 0.16); }

.stage-controls .sc-btn.danger { width: 52px; flex-basis: 52px; background: var(--danger); color: #fff; }

.stage-controls .sc-btn.danger:hover { background: #dc2626; color: #fff; }

.stage-controls .sc-btn .i, .stage-controls .sc-btn svg { width: 20px; height: 20px; }

/* Yayina katil (11-17 Napol A): izlenmeyen yayin = bulanik kucuk kare + "Yayini izle" */
.live-wait { cursor: default; background: var(--bg-panel); }
.live-thumb { position: absolute; inset: -12px; background: center / cover no-repeat;
    filter: blur(14px) brightness(.55) saturate(.8); }
.live-thumb.empty { background-image: linear-gradient(160deg, var(--bg-panel), var(--bg-hover)); filter: none; inset: 0; }
.live-over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; }
.live-watch { padding: 0.5rem 1rem; }
.live-sub { font-size: 0.75rem; color: #e7e3f7; text-shadow: 0 1px 2px #000; }
.live-badge { background: #ef4444; color: #fff; font-size: 0.625rem; font-weight: 800; letter-spacing: .05em;
    padding: 0.05rem 0.3rem; border-radius: 4px; }
/* Yayini izleyenler: kutunun sol ustunde ust uste binen avatarlar (sag ust kontrollerin) */
.live-viewers { position: absolute; left: 0.5rem; top: 0.45rem; z-index: 1; display: flex; }
.live-viewers > span { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
.live-viewers > span + span { margin-left: -6px; }
.room-user .live-badge { flex: none; }
#video-tile-self-screen .video-tile-name[data-watchers]:not([data-watchers=""])::after { content: " · " attr(data-watchers); }

/* Yayin tavani (2,5 Mbps) icin dogru secim ipucu: alt satirda tek satir */
.ss-cap { order: 3; flex-basis: 100%; color: var(--text-muted); font-size: .75rem; }
