/*
 * VOXLY_PROFILE_CONTROL_LAYOUT_0181822
 */


/* ----------------------------------------------------------
   PROFILE CONTAINER
   ---------------------------------------------------------- */

.user-panel {
    display: flex !important;

    flex-direction: column;

    align-items: stretch !important;

    gap: 10px;

    padding: 12px !important;
}


/* ----------------------------------------------------------
   TOP PROFILE ROW
   ---------------------------------------------------------- */

.voxly-profile-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    width: 100%;
}


.voxly-profile-identity {
    display: flex;

    align-items: center;

    gap: 10px;

    min-width: 0;

    flex: 1 1 auto;
}


.voxly-profile-identity
#userAvatar {
    flex: 0 0 auto;
}


.voxly-profile-identity
> div:not(#userAvatar) {
    min-width: 0;

    overflow: hidden;
}


.voxly-profile-identity
.user-name,
.voxly-profile-identity
.username {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ----------------------------------------------------------
   SETTINGS / LOGOUT
   ---------------------------------------------------------- */

.voxly-profile-utilities {
    display: flex;

    align-items: center;

    gap: 5px;

    flex: 0 0 auto;
}


.voxly-profile-utilities
.icon-btn {
    width: 30px;

    height: 30px;

    min-width: 30px;

    padding: 0;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    border-radius: 7px;

    background:
        transparent;

    border:
        1px solid transparent;

    color:
        var(--muted);

    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease;
}


.voxly-profile-utilities
.icon-btn:hover {
    background:
        var(--panel-2);

    border-color:
        var(--border);

    color:
        var(--text);
}


/* ----------------------------------------------------------
   VOICE CONTROL ROW
   ---------------------------------------------------------- */

.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-row {

    display: flex !important;

    align-items: center;

    justify-content: flex-end;

    gap: 6px;

    width: 100% !important;

    margin: 0 !important;

    padding-top: 8px !important;

    border-top:
        1px solid
        var(--border);

    background:
        transparent !important;
}


/*
 * Force all three controls into one clean horizontal row.
 */

.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-row
.voice-button {

    display: inline-flex !important;

    align-items: center;
    justify-content: center;

    flex:
        0 0 34px !important;

    width:
        34px !important;

    height:
        34px !important;

    min-width:
        34px !important;

    min-height:
        34px !important;

    margin:
        0 !important;

    padding:
        0 !important;

    grid-column:
        auto !important;

    border-radius:
        8px !important;

    border:
        1px solid
        var(--border) !important;

    background:
        var(--panel-2) !important;

    color:
        var(--text) !important;

    font-size:
        0 !important;

    box-shadow:
        none !important;
}


/* Mute */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"]::before {

    content:
        "🎙";

    font-size:
        15px;

    line-height:
        1;
}


/* Screen */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="screen"]::before {

    content:
        "▣";

    font-size:
        16px;

    line-height:
        1;
}


/* Leave */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="leave"]::before {

    content:
        "➜";

    font-size:
        17px;

    line-height:
        1;
}


/* Hover */

.user-panel
#voxlyCompactVoiceControls
.voice-button:hover:not(:disabled) {

    background:
        var(--panel-3) !important;

    border-color:
        var(--accent) !important;

    color:
        var(--accent) !important;
}


/* Leave gets subtle danger hover */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="leave"]:hover:not(:disabled) {

    border-color:
        var(--danger) !important;

    color:
        var(--danger) !important;
}


/* Disabled */

.user-panel
#voxlyCompactVoiceControls
.voice-button:disabled {

    opacity:
        .35;

    cursor:
        default;
}

/* ============================================================
   VOXLY_PROFILE_MUTE_STATE_0181823
   ============================================================ */


/* Active microphone */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"]::before {
    content: "🎙";
}


/* Muted microphone: obvious visual state */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"][data-voxly-muted="true"] {
    background:
        color-mix(
            in srgb,
            var(--danger) 18%,
            var(--panel-2)
        ) !important;

    border-color:
        var(--danger) !important;

    color:
        var(--danger) !important;
}


.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"][data-voxly-muted="true"]::before {
    content: "🔇";

    font-size: 15px;
}


/*
 * LiveKit manual audio-start fallback.
 *
 * Normally Firefox autoplay succeeds and this should not occupy
 * space in the profile control row.
 */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="audio"] {
    display: none !important;
}


/*
 * Any unidentified button in this compact group should not
 * render as an empty square.
 */

.user-panel
#voxlyCompactVoiceControls
.voice-button:not(
    [data-voxly-voice-role]
) {
    display: none !important;
}

/* VOXLY_PROFILE_AUDIO_FALLBACK_0181823 */

/*
 * Audio autoplay fallback must never render as an unlabeled
 * empty square inside the profile controls.
 */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="audio"] {
    display: none !important;
}

.user-panel
#voxlyCompactVoiceControls
.voice-button:not([data-voxly-voice-role]) {
    display: none !important;
}

/* ============================================================
   VOXLY_PROFILE_RUNTIME_VISIBILITY_0181824
   ============================================================ */

/*
 * IMPORTANT:
 * voice.js owns visibility.
 *
 * When disconnected it sets:
 *     controls.style.display = "none"
 *
 * We must NOT override that.
 */

.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-controls[style*="display: none"],
.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-row[style*="display: none"] {
    display: none !important;
}


/*
 * When voice.js makes the group visible, render it as the
 * professional single-row layout.
 */

.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-controls:not(
    [style*="display: none"]
),
.user-panel
#voxlyCompactVoiceControls.voxly-profile-voice-row:not(
    [style*="display: none"]
) {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 6px;
}


/*
 * Respect buttons that voice.js hides individually.
 *
 * This catches the LiveKit manual Start Audio fallback button,
 * which normally has inline display:none after autoplay works.
 */

.user-panel
#voxlyCompactVoiceControls
.voice-button[style*="display: none"] {
    display: none !important;
}


/*
 * Visible voice buttons.
 *
 * Do NOT use display:inline-flex !important because that would
 * override voice.js runtime visibility again.
 */

.user-panel
#voxlyCompactVoiceControls
.voice-button:not([style*="display: none"]) {
    display: inline-flex;

    align-items: center;
    justify-content: center;
}


/*
 * Connected mic — normal state.
 */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"][data-voxly-muted="false"] {
    background:
        var(--panel-2) !important;

    border-color:
        var(--border) !important;

    color:
        var(--text) !important;
}


/*
 * Connected + muted — unmistakable muted state.
 */

.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"][data-voxly-muted="true"] {
    background:
        color-mix(
            in srgb,
            var(--danger) 22%,
            var(--panel-2)
        ) !important;

    border-color:
        var(--danger) !important;

    color:
        var(--danger) !important;
}


.user-panel
#voxlyCompactVoiceControls
[data-voxly-voice-role="mute"][data-voxly-muted="true"]::before {
    content: "🔇" !important;

    font-size: 15px;
}


/*
 * Unknown compact controls should not become mystery squares.
 */

.user-panel
#voxlyCompactVoiceControls
.voice-button:not([data-voxly-voice-role]) {
    display: none !important;
}
