/**
 * Toplantı sahnesi — JS ile eklenen uzak katılımcı kutuları.
 * Blazor scoped CSS bu öğelere uygulanmaz; stiller burada global tutulur.
 */

.to-video-grid > .to-video-tile[id^="to-remote-"],
.to-video-tile.to-remote-tile {
    position: relative;
    width: min(560px, 94%);
    max-width: 560px;
    aspect-ratio: unset;
    min-height: unset;
    max-height: unset;
    height: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-sizing: border-box;
    margin: 0;
    background: linear-gradient(165deg, #243049 0%, #1a2744 48%, #0f172a 100%);
    border: 2px solid rgba(99, 102, 241, 0.55);
    border-radius: 16px;
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(148, 163, 184, 0.14);
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off,
.to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off {
    width: min(300px, 90%);
    max-width: 300px;
    border-color: rgba(100, 116, 139, 0.65);
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(148, 163, 184, 0.1);
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body {
    position: relative;
    width: 100%;
    flex: none;
    overflow: hidden;
    contain: layout style paint;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-on .to-tile-body {
    height: clamp(200px, 31vw, 315px);
    aspect-ratio: unset;
    min-height: 200px;
    max-height: min(52vh, 360px);
    background: #0b1220;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off .to-tile-body,
.to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off .to-tile-body {
    height: 176px;
    min-height: 176px;
    max-height: 176px;
    background:
        radial-gradient(ellipse at 50% 28%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
        linear-gradient(180deg, #2d3a52 0%, #1e293b 55%, #111827 100%);
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body video {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center center;
    background: #0f172a;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off .to-tile-body video,
.to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off .to-tile-body video {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-on .to-tile-body video {
    opacity: 1;
    visibility: visible;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off .to-tile-placeholder,
.to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off .to-tile-placeholder {
    display: flex;
    background: transparent;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-on .to-tile-placeholder {
    display: none;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-video-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #e0e7ff;
    background: linear-gradient(135deg, #4338ca, #312e81);
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(129, 140, 248, 0.5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off .to-video-avatar,
.to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off .to-video-avatar {
    width: 80px;
    height: 80px;
    font-size: 1.75rem;
    border: 3px solid rgba(129, 140, 248, 0.65);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-video-avatar.has-photo {
    color: transparent;
    font-size: 0;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-footer {
    display: none !important;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-tile-media-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: none;
}

.to-conn-quality,
.to-conn-pill-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    pointer-events: none;
}
.to-conn-quality {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 7;
    padding: 4px 5px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}
.to-video-self-wrap .to-conn-quality,
.to-self-dock .to-conn-quality {
    top: 6px;
    right: 6px;
    padding: 2px 3px;
    transform: scale(0.62);
    transform-origin: top right;
}
.to-video-tile[id^="to-remote-"].to-tile-user-sized .to-conn-quality {
    transform-origin: top right;
}
.to-conn-quality .to-conn-bar,
.to-conn-pill-bars > i {
    display: block;
    width: 3px;
    border-radius: 1px;
    background: rgba(148, 163, 184, 0.35);
}
.to-conn-quality .to-conn-bar:nth-child(1),
.to-conn-pill-bars > i:nth-child(1) { height: 4px; }
.to-conn-quality .to-conn-bar:nth-child(2),
.to-conn-pill-bars > i:nth-child(2) { height: 6px; }
.to-conn-quality .to-conn-bar:nth-child(3),
.to-conn-pill-bars > i:nth-child(3) { height: 9px; }
.to-conn-quality .to-conn-bar:nth-child(4),
.to-conn-pill-bars > i:nth-child(4) { height: 12px; }

.to-conn-quality.level-0 .to-conn-bar:nth-child(1),
.to-conn-pill-bars.conn-l0 > i:nth-child(1) { background: #ef4444; }
.to-conn-quality.level-1 .to-conn-bar:nth-child(-n+1),
.to-conn-pill-bars.conn-l1 > i:nth-child(-n+1) { background: #f87171; }
.to-conn-quality.level-2 .to-conn-bar:nth-child(-n+2),
.to-conn-pill-bars.conn-l2 > i:nth-child(-n+2) { background: #fbbf24; }
.to-conn-quality.level-3 .to-conn-bar:nth-child(-n+3),
.to-conn-pill-bars.conn-l3 > i:nth-child(-n+3) { background: #a3e635; }
.to-conn-quality.level-4 .to-conn-bar,
.to-conn-pill-bars.conn-l4 > i { background: #4ade80; }
.to-conn-quality.level-unknown .to-conn-bar:nth-child(1),
.to-conn-pill-bars.conn-unknown > i:nth-child(1) { background: #64748b; }

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-tile-name-overlay,
.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body > .to-video-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: block;
    padding: 8px 10px 9px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f8fafc;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.88) 45%, rgba(15, 23, 42, 0.96) 100%);
    pointer-events: none;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-perm-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
    backdrop-filter: blur(6px);
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-perm-badge.is-denied {
    background: rgba(127, 29, 29, 0.92);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.45);
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-perm-badge.is-muted {
    background: rgba(30, 41, 59, 0.92);
    color: #cbd5e1;
    border: 1px solid rgba(100, 116, 139, 0.55);
}

.to-video-grid > .to-video-tile[id^="to-remote-"].is-speaking {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5), 0 10px 32px rgba(34, 197, 94, 0.22) !important;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].is-speaking.is-dominant {
    border-color: #4ade80 !important;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.55), 0 12px 36px rgba(34, 197, 94, 0.28) !important;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].is-hand-raised {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.75), 0 14px 40px rgba(0, 0, 0, 0.5) !important;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-tile-body .to-hand-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 7;
    font-size: 1rem;
    line-height: 1;
    background: rgba(234, 179, 8, 0.9);
    border-radius: 8px;
    padding: 2px 6px;
    pointer-events: none;
}

.to-video-grid > .to-video-tile[id^="to-remote-"] .to-audio-meter,
.to-video-grid > .to-video-tile[id^="to-remote-"] .to-speaking-badge {
    display: none !important;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].is-screen-sharing::after {
    content: "🖥";
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 7;
    font-size: 0.75rem;
    background: rgba(59, 130, 246, 0.85);
    padding: 2px 6px;
    border-radius: 6px;
    pointer-events: none;
}

.to-screenshare-active .to-video-grid.to-filmstrip > .to-video-tile[id^="to-remote-"] {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
    min-height: 94px;
    height: 94px;
    border-radius: 10px;
}

.to-screenshare-active .to-video-grid.to-filmstrip > .to-video-tile[id^="to-remote-"].to-video-off .to-tile-body,
.to-screenshare-active .to-video-grid.to-filmstrip > .to-video-tile[id^="to-remote-"].to-remote-cam-off .to-tile-body,
.to-screenshare-active .to-video-grid.to-filmstrip > .to-video-tile[id^="to-remote-"].to-video-on .to-tile-body {
    height: 94px;
    min-height: 94px;
    max-height: 94px;
}

.to-layout-spotlight .to-video-tile[id^="to-remote-"]:not(.is-dominant) {
    opacity: 0.35;
}

.to-layout-spotlight .to-video-tile[id^="to-remote-"].is-dominant {
    grid-column: 1 / -1;
    width: min(560px, 94%);
}

/* Hızlı tepki — katılımcı kartının üstünde */
.to-video-tile .to-tile-reaction-float,
.to-self-dock .to-tile-reaction-float {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) scale(0.35);
    font-size: 2.75rem;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    white-space: nowrap;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.55));
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.to-video-tile .to-tile-reaction-float.show,
.to-self-dock .to-tile-reaction-float.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}
.to-video-tile .to-tile-reaction-float.hide,
.to-self-dock .to-tile-reaction-float.hide {
    opacity: 0;
    transform: translateX(-50%) scale(0.85) translateY(-12px);
}

/* Kullanıcı boyutlandırması — sağ alt köşeden sürükle */
.to-video-tile.to-tile-user-sized {
    flex-shrink: 0;
}
.to-tile-resize-handle {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 18px;
    height: 18px;
    z-index: 12;
    cursor: nwse-resize;
    touch-action: none;
    border-radius: 0 0 10px 0;
    background: linear-gradient(135deg, transparent 50%, rgba(99, 102, 241, 0.85) 50%);
    opacity: 0.85;
}
.to-tile-resize-handle:hover {
    opacity: 1;
}
.to-self-dock .to-tile-resize-handle {
    width: 16px;
    height: 16px;
    z-index: 20;
    cursor: nwse-resize;
}
.to-self-dock.to-self-dock-user-sized {
    overflow: visible;
}

.to-video-grid > .to-video-tile[id^="to-remote-"].is-screen-sharing .to-tile-body video {
    display: none !important;
}
.to-video-grid > .to-video-tile[id^="to-remote-"].is-screen-sharing .to-tile-placeholder {
    display: flex !important;
}

.to-video-tile.to-tile-reconnecting {
    opacity: 0.92;
    outline: 1px dashed rgba(99, 102, 241, 0.45);
}

@media (max-width: 900px) {
    .to-video-grid > .to-video-tile[id^="to-remote-"].to-video-off,
    .to-video-grid > .to-video-tile[id^="to-remote-"].to-remote-cam-off {
        width: min(280px, 92%);
        max-width: 280px;
    }
}
