*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html,
body{

    width:100%;
    height:100dvh;

    overflow:hidden;

    font-family:Arial,sans-serif;

    background:#181b20;

}

body{

    display:flex;
    min-height:100dvh;
}

/* =======================
   SIDEBAR
======================= */

#sidebar{
    position:relative;

    width:340px;

    min-width:340px;

    max-width:340px;

    height:100dvh;

    background:#242830;

    border-right:1px solid #323845;

    display:flex;

    flex-direction:column;

    overflow:hidden;

}

.sidebar-header{

    display:flex;

    align-items:center;

    gap:12px;

    padding:18px;

    border-bottom:1px solid #353c49;

    background:#2b3038;

}

#back-sidebar{

    display:none;

    width:42px;
    height:42px;

    flex:none;

    border:none;
    border-radius:8px;

    background:#2d3440;

    color:#fff;

    font-size:20px;

    cursor:pointer;

}

#back-sidebar:hover{

    background:#3d4756;

}


#search{

    width:100%;

    padding:12px 15px;

    border:none;

    border-radius:8px;

    outline:none;

    font-size:15px;

    background:#17191d;

    color:#fff;

}

#search::placeholder{

    color:#8b9099;

}

/* =======================
   TREE
======================= */

#tree{

    flex:1;

    overflow-y:auto;

    overflow-x:hidden;

    padding:12px;

}

.group{

    margin-bottom:10px;

}

.group-header{

    display:flex;

    align-items:center;

    justify-content:space-between;

    padding:11px 12px;

    border-radius:8px;

    background:#303744;

    color:#fff;

    cursor:pointer;

    user-select:none;

    font-weight:bold;

    transition:.2s;

}

.group-header:hover{

    background:#394150;

}

.group-body{

    padding-top:6px;

}

.group-body.collapsed{

    display:none;

}

/* =======================
   CAMERA
======================= */

.camera{

    display:flex;

    align-items:center;

    gap:10px;

    padding:9px 12px;

    margin:2px 0;

    border-radius:8px;

    cursor:pointer;

    transition:.15s;

}

.camera:hover{

    background:#313949;

}

.camera.active{

    background:#3f6ad8;

}

.camera-name{

    flex:1;

    color:#f0f0f0;

    font-size:14px;

    overflow:hidden;

    text-overflow:ellipsis;

    white-space:nowrap;

}

.status{

    width:10px;

    height:10px;

    border-radius:50%;

    flex:none;

}

.status.online{

    background:#39d353;

    box-shadow:0 0 8px rgba(57,211,83,.7);

}

.status.offline{

    background:#d83f3f;

}

.favorite{

    color:#999;

    font-size:18px;

    cursor:pointer;

    transition:.2s;

}

.favorite:hover{

    color:#ffd54f;

}

.favorite.active{

    color:#ffd54f;

}
/* =======================
   PLAYER
======================= */

#player{
    position:relative;

    flex:1;

    display:flex;

    flex-direction:column;

    background:#111417;

    overflow:hidden;

}

.player-header{

    height:64px;

    display:flex;

    align-items:center;

    gap:15px;

    padding:0 20px;

    border-bottom:1px solid #2d333d;

    background:#1d2127;

}

.player-header h2{

    flex:1;

    color:white;

    font-size:22px;

    font-weight:600;

    overflow:hidden;

    text-overflow:ellipsis;

    white-space:nowrap;

}

#fullscreen{

    width:42px;

    height:42px;

    border:none;

    border-radius:8px;

    background:#2d3440;

    color:white;

    cursor:pointer;

    font-size:18px;

    transition:.2s;

}

#fullscreen:hover{

    background:#3d4756;

}

#logout {
    height: 38px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: #2d3440;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: .2s;
}

#logout:hover {
    background: #3d4756;
}

#back:hover{

    background:#3d4756;

}

video{

    flex:1;

    width:100%;

    height:100%;

    object-fit:contain;

    background:black;

}

/* =======================
   SCROLLBAR
======================= */

#tree::-webkit-scrollbar{

    width:8px;

}

#tree::-webkit-scrollbar-track{

    background:#242830;

}

#tree::-webkit-scrollbar-thumb{

    background:#4b5565;

    border-radius:20px;

}

#tree::-webkit-scrollbar-thumb:hover{

    background:#5f6b80;

}

/* =======================
   TRANSITIONS
======================= */

.group-body{

    transition:.25s;

}

.camera{

    transition:
        background .15s,
        color .15s,
        transform .1s;

}

.camera:active{

    transform:scale(.98);

}
/* ==========================
   Глобальная кнопка Назад
========================== */

#back{

    display:none;

    width:42px;
    height:42px;

    flex:none;

    border:none;
    border-radius:8px;

    background:#2d3440;
    color:#fff;

    font-size:20px;

    cursor:pointer;

}

#back:hover{

    background:#3d4756;

}

/* На телефоне штатная кнопка Safari лучше,
   поэтому кнопку полноэкранного режима скрываем */

@media (max-width:899px){

    body{

        display:block;

    }

    #sidebar{

        width:100%;
        max-width:none;
        min-width:0;
        display:flex;
    }

    #player{

        display:none;
        position:fixed;

        inset:0;

        width:100%;
        z-index:20;
    }
 #fullscreen{

        display:none;

    }

    #back{

        margin-right:10px;

    }

    #back-sidebar{

        display:block;

    }

    #search{

        flex:1;

        width:auto;

    }

}
