/* RTC Modes (Mesh/Nexus) – cosmetic helpers driven by root wrapper classes
   Classes applied by JS: rtc-mode-full, rtc-mode-audio-only, rtc-mode-video-only, rtc-mode-data-only */

/* Toolbar wraps nicely on small viewports */
#rtc-toolbar {
    flex-wrap: wrap;
}

/* Disabled buttons look intentionally subdued */
#rtc-av-root .btn[disabled] {
    opacity: .5;
}

/* Mic control is visually deemphasized in video-only mode (logic already disables where needed) */
#rtc-av-root.rtc-mode-video-only #btn-mic {
    opacity: .5;
}

/* Placeholder tiles (data-only presence) */
.rtc-video-wrapper.placeholder {
    /* Leverage existing .rtc-video-wrapper sizing from rtc-grid.css */
    background-color: #0b0b0b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rtc-video-wrapper.placeholder .rtc-video-label {
    /* reuse existing label style; no changes needed */
}

/* Compact placeholders in data-only mode (smaller footprint) */
#rtc-av-root.rtc-mode-data-only .rtc-video-wrapper.placeholder {
    aspect-ratio: 1 / 1;
    max-height: 220px;
}

/* Overlay used when a stream has audio but no video */
.rtc-video-wrapper .rtc-placeholder-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35));
    z-index: 4;
    pointer-events: none;
}

.rtc-video-wrapper .rtc-placeholder-overlay .rtc-video-label {
    position: static;
    /* use natural flow in overlay */
    background-color: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
}

.rtc-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--rmt-bg-surface-2);
    color: var(--rmt-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

/* Init controls: responsive collapse animation (structural) */
.init-controls-wrapper {
    position: relative;
}

/* Make the card animatable (critical for collapse) */
.init-controls {
    /* Ensure content can be clipped during animation */
    overflow: hidden;
    min-height: 0;
    /* Smooth height+opacity transition without layout jumps */
    transition: max-height 220ms ease, opacity 180ms ease, margin 200ms ease;
    max-height: 1200px;
    /* large enough for expanded content */
    opacity: 1;
    will-change: max-height, opacity;
}

/* Collapsed state driven by wrapper class */
.init-controls-wrapper.is-collapsed .init-controls {
    max-height: 0 !important;
    opacity: 0;
    visibility: hidden;
    margin-bottom: 0 !important;
    pointer-events: none;
}

/* Suppress inner padding/border while collapsed to avoid ghost space */
.init-controls-wrapper.is-collapsed .init-controls .card-body {
    padding: 0 !important;
    border: 0 !important;
}

/* Toggle button: unobtrusive and theme-aware (wrapper placement) */
.init-controls-toggle {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 20;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--rmt-bg-surface);
    border: 1px solid var(--rmt-bg-surface-2);
    color: var(--rmt-text-primary);
    border-radius: var(--rmt-radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.init-controls-toggle i {
    font-size: 1rem;
    line-height: 1;
    transition: transform 160ms ease;
}

/* Inline variant: when moved into the toolbar on collapse */
.init-controls-toggle.init-toggle-inline {
    position: static;
    width: auto;
    height: auto;
    padding: 2px 8px;
    border-radius: var(--rmt-radius-sm);
    box-shadow: none;
    margin-left: 6px;
    /* slight spacing within toolbar */
}

.init-controls-toggle.init-toggle-inline i {
    font-size: 0.95rem;
}

/* Hover/active/focus */
.init-controls-toggle:hover {
    background-color: #edf2f7;
    border-color: #cbd5e1;
}

.init-controls-toggle:active {
    transform: scale(0.96);
}

.init-controls-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--rmt-primary-dim);
}

/* Collapsed affordance */
.init-controls-wrapper.is-collapsed .init-controls-toggle {
    opacity: 0.92;
}

.init-controls-wrapper.is-collapsed .init-controls-toggle i {
    transform: rotate(180deg);
}

/* Mobile tweaks */
@media (max-width: 575.98px) {
    .init-controls-toggle {
        width: 36px;
        height: 36px;
        right: 10px;
        top: 10px;
    }

    .init-controls-toggle.init-toggle-inline {
        padding: 4px 10px;
    }
}